![]() |
|||
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
| ||||
Chapter 4Tracing MechanismThis chapter explains how to use the tracing mechanism to help you trace or debug the Java Dynamic Management Kit (Java DMK) API. The tracing mechanism gives you internal runtime information, and you can specify the information type and level of trace and debug information you want to receive. Note - The proprietary tracing mechanism classes described in this chapter are all deprecated as of Java DMK 5.1. These classes have all been superseded by the java.util.logging classes that are now supported by the Java Management Extensions (JMX). How to activate logging using the java.util.logging API is explained in 4.1 Activating the java.util.logging API. The information contained in the rest of this chapter is deprecated and is retained for purposes of backwards compatibility only. 4.1 Activating the java.util.logging APITo activate traces using the standard java.util.logging API, you must edit, or copy and edit, the template.logging.properties file that is provided by Java DMK in the directory installDir/etc/conf/. You must uncomment the categories from which you want to obtain traces, and the level of tracing you require. Then pass the file on the command line when starting your Java classes, as follows
4.2 Receiving Trace and Debug Information Using the Deprecated TraceManagerTo receive trace and debug information you must add a notification listener to the class com.sun.jdmk.TraceManager. You control the tracing by defining the trace properties specific to the Java DMK. Three factors affect tracing:
The com.sun.jdmk.trace.Trace class is used to emit trace messages. All the classes of the Java DMK use this Trace class for sending traces. You can use the Trace class in your own code for producing debug traces for your own classes. The com.sun.jdmk.TraceManager class provides methods for receiving trace and debug messages. Options provided by the TraceManager class are described in the following sections: The com.sun.jdmk.TraceManager class uses the notification mechanism to distribute the information. You must add a notification listener to receive information (see example Example 4-1). There are two ways to receive trace information.
Example 4-1 Creating a Notification Listener
Example 4-2 Creating a Trace Filter
Example 4-3 Adding the Notification Listener to the class
4.3 Specifying the Type of Trace and Debug InformationIt is possible to specify the type of trace and debug information you want to receive. The following types are specified.
The preceding information is held by the TraceTags class | ||||
| ||||
![]() |