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.

About this task

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
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 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 Java from the JAR file com.ibm.mq.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 Java 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 Java from the JAR file com.ibm.mq.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 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.