+

Search Tips | Advanced Search

Collecting an IBM MQ classes for Java trace dynamically by using the traceControl utility

The traceControl utility that is shipped with the IBM MQ classes for Java allows trace to be collected from a running application. This can be very useful if IBM Support need to see a trace from an application once an issue has occurred, or if trace needs to be collected from a critical application that cannot be stopped.


About this task

For more information about the traceControl utility, see Controlling trace in a running process by using IBM MQ classes for Java and IBM MQ classes for JMS.

To collect a trace by using the traceControl utility, complete the following steps.


Procedure

  1. Bring up a command prompt, and navigate to the directory MQ_INSTALLATION_PATH\java\lib.
  2. Run the command:
    java -jar com.ibm.mq.traceControl -list 
    This command brings up a list of all of the Java processes on the system.
  3. Identify the process identifier for the IBM MQ classes for Java application that needs to be traced, and run the command:
    java -jar com.ibm.mq.traceControl -i process identifier -enable
    Trace is now turned on for the application.By default, trace information is written to a trace file in the current working directory of the application. The name of the trace file depends upon the environment that the application is running in:

    • For IBM MQ classes for Java for Version 9.0.0, Fix Pack 1 or earlier, trace is written to a file called mqjms_%PID%.trc.
    • From Version 9.0.0, Fix Pack 2, if the application has loaded the IBM MQ classes for Java from the JAR file com.ibm.mq.jar, trace is written to a file called mqjava_%PID%.trc.
    • From Version 9.0.0, Fix Pack 2, if the application has loaded the IBM MQ classes for Java from the relocatable JAR file com.ibm.mq.allclient.jar, trace is written to a file called mqjavaclient_%PID%.trc.
    • From Version 9.0.0, Fix Pack 10, if the application has loaded the IBM MQ classes for Java from the JAR file com.ibm.mq.jar, trace is written to a file called mqjava_%PID%.cl%u.trc.
    • From Version 9.0.0, Fix Pack 10, if the application has loaded the IBM MQ classes for Java from the relocatable JAR file com.ibm.mq.allclient.jar, trace is written to a file called mqjavaclient_%PID%.cl%u.trc.

    where %PID% is the process identifier of the application that is being traced, and %u is a unique number to differentiate files between threads running trace under different Java classloaders.

  4. To turn trace off, run the command:
    java -jar com.ibm.mq.traceControl -i process identifier -disable