|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.management.jmx.Trace
This class is a static class and is used to get JMX internal runtime information.
Two levels of information can be specified:
1) trace. It provides information to tell what JMX is doing, this information is used to help a user to develop a JMX application.
2) debug. It provides information to help a JMX developper to diagnose the JMX implementation.
A user can specify information types to select information. The following types are specified:
1) INFO_ADAPTOR_HTML Information from HTML adaptor.
2) INFO_MBEANSERVER. Information from a MBean Server.
3) INFO_MLET. Information from a MLet service.
4) INFO_MONITOR. Information from a Monitor.
5) INFO_TIMER. Information from a Timer.
6) INFO_MISC. Information from all other classes except those specified types.
7) INFO_ALL. Information from all classes.
8) INFO_RELATION. Information from Relation Service.
8) INFO_MODELMBEAN. Information from the Model MBean components.
This class uses notification machanism to distribute the information. To register a listener, a TraceFilter object should be provided to do filtering. There are two ways to receive trace information:
parseTraceProperties
method of this class.
To specifiy trace level, add -DLEVEL_TRACE or -DLEVEL_DEBUG to you command line. By default, the level is set to LEVEL_TRACE.
To specifiy trace types, add the selected types to the command line as: -DINFO_MLET -DINFO_TIMER to select mlet and timer information, it is possible to add more than one type. By default, the type is set to INFO_ALL.
To specify output, add -DTRACE_OUTPUT=name_of_outfile to the command line, name_of_outfile is a file name to write message. By default, the message is written to screen.
If at least of the three properties is specified in the command, all other which are not specified will be set to default value.
Field Summary | |
static int |
INFO_ADAPTOR_HTML
Information type defined for HTML adaptor information. |
static int |
INFO_ALL
Information type defined to represent all types defined. |
static int |
INFO_MBEANSERVER
Information type defined for MBean Server information. |
static int |
INFO_MISC
Information type defined for all other classes. |
static int |
INFO_MLET
Information type defined for MLet service information. |
static int |
INFO_MODELMBEAN
Information type defined for Model MBean |
static int |
INFO_MONITOR
Information type defined for Monitor information. |
static int |
INFO_RELATION
Information type defined for Relation Service. |
static int |
INFO_TIMER
Information type defined for Timer information. |
static int |
LEVEL_DEBUG
Information level defined for debug level. |
static int |
LEVEL_TRACE
Information level defined for trace level. |
protected static java.lang.String |
UNKOWNTYPE
|
Constructor Summary | |
Trace()
|
Method Summary | |
static void |
addNotificationListener(NotificationListener listener,
NotificationFilter f,
java.lang.Object handback)
Add a listener with filtering conditions |
static void |
addNotificationListener(TraceListener listener,
java.lang.Object handback)
Add a listener with default filtering conditions: all types but only trace level are selected. |
protected static java.lang.String |
getRIType(int type)
|
static boolean |
isSelected(int level,
int type)
Verify whether the specified info level and the info type are selected by a listener. |
static void |
parseTraceProperties()
Parses the system properties specified at the command-line to determine the specified trace conditions |
static void |
removeAllListeners()
Remove all listeners. |
static void |
removeNotificationListener(NotificationListener listener)
Remove a listener |
static boolean |
send(int level,
int type,
java.lang.String className,
java.lang.String methodName,
java.lang.String info)
Send a new information to this Trace class |
static boolean |
send(int level,
int type,
java.lang.String className,
java.lang.String methodName,
java.lang.Throwable exception)
Send an exception to this Trace class. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int LEVEL_TRACE
public static final int LEVEL_DEBUG
public static final int INFO_MBEANSERVER
public static final int INFO_MLET
public static final int INFO_MONITOR
public static final int INFO_TIMER
public static final int INFO_ADAPTOR_HTML
public static final int INFO_MISC
public static final int INFO_RELATION
public static final int INFO_MODELMBEAN
public static int INFO_ALL
protected static final java.lang.String UNKOWNTYPE
Constructor Detail |
public Trace()
Method Detail |
public static boolean isSelected(int level, int type)
It is strongly recommanded to call this method before sending an information to this Trace class.
level
- the level of trace information.type
- the type of the trace information.public static void parseTraceProperties() throws java.io.IOException
public static boolean send(int level, int type, java.lang.String className, java.lang.String methodName, java.lang.String info)
level
- the level of trace information to be sent.type
- the type of trace information to be sent.className
- the name of the class from which the trace information is from.methodName
- the name of the method from which the trace information is from.info
- the trace information to be sent.public static boolean send(int level, int type, java.lang.String className, java.lang.String methodName, java.lang.Throwable exception)
level
- the level of trace information to be sent.type
- the type of trace information to be sent.className
- the name of the class from which the trace information is from.methodName
- the name of the method from which the trace information is from.exception
- exception sent as the trace information.public static void addNotificationListener(NotificationListener listener, NotificationFilter f, java.lang.Object handback) throws java.lang.IllegalArgumentException
listener
- the listener to be added to receive trace notification.f
- the filter used to select a trace notification. This filter should be
an instance of the class TraceFilter or its sub-class. If the filter is set to null
all trace information with any type and any level will be send to the listener.handback
- the object sent back to listener.public static void addNotificationListener(TraceListener listener, java.lang.Object handback) throws java.lang.IllegalArgumentException
listener
- the listener to be added to receive trace notification.handback
- the object will send back to listener.public static void removeNotificationListener(NotificationListener listener)
listener
- the listener to be removed.public static void removeAllListeners()
protected static java.lang.String getRIType(int type)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |