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

The traceControl utility that is shipped with the IBM® MQ classes for JMS 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

Important: This function is supported for IBM Java runtime environments (JREs) only.

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.jar -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 JMS application that needs to be traced, and run the command:
    java -jar com.ibm.mq.traceControl.jar -i processidentifier -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 JMS for IBM MQ 9.0.0 Fix Pack 1 or earlier, trace is written to a file called mqjms_%PID%.trc.
    • [V9.0.0.2 Sep 2017]From IBM MQ 9.0.0 Fix Pack 2, if the application has loaded the IBM MQ classes for JMS from the JAR file com.ibm.mqjms.jar, trace is written to a file called mqjava_%PID%.trc.
    • [V9.0.0.2 Sep 2017]From IBM MQ 9.0.0 Fix Pack 2, if the application has loaded the IBM MQ classes for JMS from the relocatable JAR file com.ibm.mq.allclient.jar, trace is written to a file called mqjavaclient_%PID%.trc.
    • [V9.0.0.10 May 2020]From IBM MQ 9.0.0 Fix Pack 10, if the application has loaded the IBM MQ classes for JMS from the JAR file com.ibm.mqjms.jar, trace is written to a file called mqjava_%PID%.cl%u.trc.
    • [V9.0.0.10 May 2020]From IBM MQ 9.0.0 Fix Pack 10, if the application has loaded the IBM MQ classes for JMS 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.jar -i processidentifier -disable