Logging and IBM MQ classes for JMS
By default, log output is sent to the mqjms.log file. We can redirect it to a specific file or directory.
The IBM MQ classes for JMS log facility is provided to report serious problems, particularly problems that might indicate configuration errors rather than programming errors. By default, log output is sent to the mqjms.log file in the JVM working directory.
We can redirect log output to another file by setting the property com.ibm.msg.client.commonservices.log.outputName. The value for this property can be:- A single path name.
- A comma-separated list of path names (all data is logged to all files).
Each path name can be:
- Absolute or relative.
- stderr or System.err to represent the standard error stream.
- sttdout or System.out to represent the standard output stream.
If the value of the property identifies a directory, log output is written to mqjms.log in that directory. If the value of the property identifies a specific file, log output is written to that file.
We can set this property in the IBM MQ classes for JMS configuration file or as a system property on the java command. In the following example, the property is set as a system property and identifies a specific file:java -Djava.library.path= library_path -Dcom.ibm.msg.client.commonservices.log.outputName=/mydir/mylog.txt MyAppClassIn the command, library_path is the path to the directory containing the IBM MQ classes for JMS libraries (see Configure the Java Native Interface (JNI) libraries ).
We can disable log output by setting the property com.ibm.msg.client.commonservices.log.status to OFF. The default value of this property is ON.
The values System.err and System.out can be set to send log output to the System.err and System.out streams.
Parent topic: Solving problems with IBM MQ classes for JMS