MQ Everyplace® does not automatically capture the trace information provided by the MQeTrace.trace()
methods. The solution programmer must capture the trace messages. We strongly recommend that your solution includes a mechanism to allow the capture of MQ Everyplace trace events, as this output might be requested by the IBM® service teams when investigating any problems reported.
To capture MQ Everyplace trace information, you need to ensure that
- A trace handler has been provided, and set using the MQeTrace.setHandler() method.
- The runtime filter maintained by the MQeTrace.setFilter() method does not exclude the information you want to capture.
The required trace handler must implement the MQeTraceHandler interface. MQ Everyplace ships with several trace handlers, used for different purposes:
This trace handler renders trace information to a printstream in a readable format.MQeTraceToBinaryFile
This trace handler collects trace information into a file, or sequence of files. MQeTraceFromBinaryFile
You can use this trace handler to render this binary information file format into readable text. MQeTraceToBinaryMidp
This trace handler collects binary trace information when running inside an MIDP Java environment.
// Allocate a trace instance, so that our handler
// is not garbage collected when it's on.
myMQeTrace = new MQeTrace();
// Allocate a trace handler
// This one puts trace output to stdout by default.
MQeTraceHandler handler = (MQeTraceHandler)
// Set this handler as the one MQe uses.
// Set the filter so we collect those
// pieces of trace we are interrested in.
// In this case, collect all the default trace information.
// To end trace set the filter to zero and the handler to null
This example shows the creation of a trace handler, MQeTraceToReadable
in this case, and setting of the filter to capture the default trace information. This action can result in lots of information being captured. You can use a more restrictive filter to capture only a subset of the data. For example, collecting errors, warnings, and user-coded trace points might be more appropriate:
MQeTrace.GROUP_ERROR | MQeTrace.GROUP_WARNING | MQeTrace.GROUP_MASK_USER_DEFINED
- The IBM Service team might ask you to use the MQeTrace.GROUP_MASK_ALL value when diagnosing a problem.
- When using the MQeTraceToBinaryMidp trace handler, you require an additional step to recover the trace. The MIDP trace handler either stores the trace in a record store or in memory. After the trace has finished, call sendDataToUrl() to recover this binary data. By default, this call sends the data to a servlet. For more information, refer to the examples.trace.MQeTraceServlet section of the MQ Everyplace Java Programming Reference.
Parent topic: Tracing and logging with Java: XPD622