Collecting an IBM MQ classes for Java trace by using a Java system property

For issues that can be reproduced in a short amount of time, IBM MQ classes for Java trace should be collected by setting a Java system property when starting the application.


To collect a trace by using a Java system property, complete the following steps.


Procedure

Run the application that is going to be traced by using the following command:
java -Dcom.ibm.msg.client.commonservices.trace.status=ON application_name
When the application starts, the IBM MQ classes for Java start writing trace information to a trace file in the application's current working directory. The name of the trace file depends on 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.1.5 and Version 9.1.0, Fix Pack 5, 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.1.5 and Version 9.1.0, Fix Pack 5, 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.

The application stops writing information to the trace file when it is stopped.

If the application has to run for a long period of time before the issue that the trace is being collected for occurs, then the trace file could potentially be very large. In this situation, consider collecting trace by using the IBM MQ classes for Java configuration file (see Collecting an IBM MQ classes for Java trace by using the IBM MQ classes for Java configuration file). When enabling trace in this way, it is possible to control the amount of trace data that the IBM MQ classes for Java generate.

Parent topic: Tracing IBM MQ classes for Java applications