Writing your own trace handler (Java)

Solution providers may wish to write their own trace handlers, to
  • Do more complex filtering.
  • Store trace information in a different place or form to that used by the supplied trace handlers
  • Reroute trace information generated through this mechanism to another trace capture mechanism. For example, the trace handlers supplied with MQe rely on function supplied by underlying classes:
    com.ibm.mqe.trace.MQeTracePointGroup
    This class holds information about a logical grouping of trace points.
    com.ibm.mqe.trace.MQeTraceRenderer
    Provides a programmatic way of managing a collection of tracePointGroups and tracePoints information. It provides methods to add or remove tracePointGroups, individual tracePoints to and from the collection of tracePointGroups, and collection of tracePoints.
    com.ibm.mqe.trace.MQeTracePoint
    A collection of information that describes a particular trace point.

The trace handlers in the product populate a series of MQeTracePointGroup objects with a collection of MQeTracePoint objects. The groups are added to the MQeTraceRenderer, and the MQeTraceRenderer is used to map from the trace point number passed on the MQeTrace.trace() methods, to a readable string.

The separation of the readable string from the trace point number allows the code to collect just the number, and separate the information collection stage from the stage that renders to readable strings.

Where possible, the trace handlers supplied also gather stack trace information when a java.lang.throwable is passed as a parameter to the MQeTrace.trace() method.

You can implement the trace handler interface, and intercept trace information from your application and the MQe system classes. For examples of this, refer to the following classes in the MQe Java™ Programming Reference:
  • examples.trace.MQeTrace
  • examples.trace.MQeTraceToFile

You can add trace points to existing trace point groups, or to your own trace point groups. You can add these to the base MQeTraceRenderer, and use them in conjunction with the existing trace handlers. For an example of this, please refer to the MQeTrace class section of the MQe Java Programming Reference.


Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.