WebSphere MQ base Java includes a trace facility, which you can use to produce diagnostic messages if you suspect that there might be a problem with the code. (You normally need to use this facility only at the request of IBM(R) service.)
Tracing is controlled by the enableTracing and disableTracing methods of the MQEnvironment class. For example:
MQEnvironment.enableTracing(2); // trace at level 2 ... // these commands will be traced MQEnvironment.disableTracing(); // turn tracing off again
The trace is written to the Java(TM) console (System.err).
If your program is an application, or if you run it from your local disk using the appletviewer command, you can also redirect the trace output to a file of your choice. The following code fragment shows an example of how to redirect the trace output to a file called myapp.trc:
import java.io.*; try { FileOutputStream traceFile = new FileOutputStream("myapp.trc"); MQEnvironment.enableTracing(2,traceFile); } catch (IOException ex) { // couldn't open the file, // trace to System.err instead MQEnvironment.enableTracing(2); }
There are five different levels of tracing:
To trace methods in the Java Virtual Machine with trace level 5:
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
csq77t2 |