All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.reference.common.Debug

java.lang.Object
   |
   +----com.sun.jaw.reference.common.Debug

public class Debug
extends Object
This class provides methods for printing debug messages or logging them to a file. It is possible to specify the trace level of the debug messages. All the classes of the Java Dynamic Management Kit use this class for printing debug messages. You can use this class in your own code for printing debug messages for your own classes.

It is possible to specify the trace level in either of the following ways:

The system properties for specifying a trace level are:
PropertyTrace Level
DEBUGAll messages
DEFAULTMessages that are not associated with a predefined trace level
DEBUG_CMFMessages from the framework
DEBUG_ADAMessages from the adaptors
DEBUG_EXCPTExceptions
DEBUG_REPOMessages from the repository service
DEBUG_METAMessages from the metadata service
DEBUG_RELAMessages from the relationship service
DEBUG_MLETMessages from the m-let service
DEBUG_SNMPMessages from the SNMP Manager service
DEBUG_DISCOMessages from the discovery service

In addition, the DEBUG_HEAVY property can be set to get additional traces. Setting the DEBUG property will not switch on the heavy printing.

To specify that debug messages are logged to a file, specify the DEBUG_OUTPUT=filename system property.

The setDefault method enables or disables default mode. If default mode is enabled, messages for the selected trace level and messages not associated with a predefined trace level are printed. If default mode is disabled, no messages that are not associated with a predefined trace level are printed. Only messages for the selected trace level are printed.


Variable Index

 o ADP_DEBUG
Trace level for the adaptors.
 o CMF_DEBUG
Trace level for the framework.
 o DISCO_DEBUG
Trace level for the discovery service.
 o EXCPT_DEBUG
Trace level for exceptions.
 o HEAVY_DEBUG
Trace level for getting very talkative traces.
 o META_DEBUG
Trace level for the metadata service.
 o MLET_DEBUG
Trace level for the m-let service.
 o NO_DEBUG
No trace.
 o REL_DEBUG
Trace level for relationship service.
 o REP_DEBUG
Trace level for the repository service.
 o SNMP_DEBUG
Trace level for the Snmp Manager service.
 o TRACE_DEBUG
Trace level for any class.

Constructor Index

 o Debug()

Method Index

 o flush()
Flushes the trace stream.
 o getLevel()
Gets the currently selected trace levels.
 o getLog()
Gets the current log used for logging debug messages.
 o isLevelSet(int)
Check if atLevel is set.
 o parseDebugProperties()
Parses the system properties specified at the command-line to determine the specified trace level.
 o print(boolean, Object)
Traces an object according a condition.
 o print(int, Object)
Traces an object with a specific trace level.
 o print(Object)
Traces an object.
 o printException(Exception)
Traces an exception.
 o printFormatted(Object)
Write a message on the printer stream associated with the Debug object.
 o println(boolean, Object)
Traces an object according a condition and appends a carriage return.
 o println(int, Object)
Traces an object with a specific level and appends a carriage return.
 o println(Object)
Traces an object and appends a carriage return.
 o setDefault(boolean)
Enables or disables default mode.
 o setLevel(int)
Sets the trace level.
 o setLog(PrintWriter)
Sets the log for debug messages.
 o setOff(int)
Deactivates a specific trace level.
 o setOffAll()
Deactivates all trace levels, so that no debug messages will be printed.
 o setOn(int)
Activates a specific trace level.
 o setOnAll()
Activates all trace levels, so that debug messages for all traces will be printed.

Variables

 o NO_DEBUG
 public static final int NO_DEBUG
No trace.

 o CMF_DEBUG
 public static final int CMF_DEBUG
Trace level for the framework. Corresponds to the DEBUG_CMF system property.

 o ADP_DEBUG
 public static final int ADP_DEBUG
Trace level for the adaptors. Corresponds to the DEBUG_ADA system property.

 o REP_DEBUG
 public static final int REP_DEBUG
Trace level for the repository service. Corresponds to the DEBUG_REPO system property.

 o EXCPT_DEBUG
 public static final int EXCPT_DEBUG
Trace level for exceptions. Corresponds to the DEBUG_EXCPT system property.

 o META_DEBUG
 public static final int META_DEBUG
Trace level for the metadata service. Corresponds to the DEBUG_META system property.

 o TRACE_DEBUG
 public static final int TRACE_DEBUG
Trace level for any class. Use to distinguish between messages from classes the Java Dynamic Management Kit and other classes.

 o REL_DEBUG
 public static final int REL_DEBUG
Trace level for relationship service. Corresponds to the DEBUG_RELA system property.

 o MLET_DEBUG
 public static final int MLET_DEBUG
Trace level for the m-let service. Corresponds to the DEBUG_MLET system property.

 o DISCO_DEBUG
 public static final int DISCO_DEBUG
Trace level for the discovery service. Corresponds to the DEBUG_DISCO system property.

 o SNMP_DEBUG
 public static final int SNMP_DEBUG
Trace level for the Snmp Manager service. Corresponds to the DEBUG_SNMP system property.

 o HEAVY_DEBUG
 public static final int HEAVY_DEBUG
Trace level for getting very talkative traces. DEBUG_HEAVY system property.

Constructors

 o Debug
 public Debug()

Methods

 o printFormatted
 public static void printFormatted(Object arg)
Write a message on the printer stream associated with the Debug object. If the stream is null, the method will use System.err The method will pritn the object regardless the setting of the trace level.

 o flush
 public static void flush()
Flushes the trace stream.

 o print
 public static void print(Object arg)
Traces an object. If the default mode is disabled, nothing is printed.

 o print
 public static void print(int atLevel,
                          Object arg)
Traces an object with a specific trace level. If the specified trace level is not activated, nothing is printed.

 o print
 public static void print(boolean condition,
                          Object arg)
Traces an object according a condition. If condition is true and the default mode is enabled, the object is printed on the trace stream.

 o println
 public static void println(Object arg)
Traces an object and appends a carriage return. If the default mode is disabled nothing is printed.

 o println
 public static void println(int atLevel,
                            Object arg)
Traces an object with a specific level and appends a carriage return. If the specified trace level is not activated, nothing is printed.

 o println
 public static void println(boolean condition,
                            Object arg)
Traces an object according a condition and appends a carriage return. If condition is true and the default mode is enabled, the object is printed on the trace stream.

 o printException
 public static void printException(Exception e)
Traces an exception. If the trace level EXCPT_DEBUG is not activated, nothing is printed.

 o parseDebugProperties
 public static void parseDebugProperties()
Parses the system properties specified at the command-line to determine the specified trace level.

 o isLevelSet
 public static boolean isLevelSet(int atLevel)
Check if atLevel is set.

 o getLevel
 public static int getLevel()
Gets the currently selected trace levels. They are expressed as a bit map (by ORing the different trace levels defined by the class).

Returns:
The currently selected trace levels.
 o getLog
 public static PrintWriter getLog()
Gets the current log used for logging debug messages.

Returns:
The current PrintWriter stream used for logging debug messages.
 o setOnAll
 public static void setOnAll()
Activates all trace levels, so that debug messages for all traces will be printed.

 o setOn
 public static void setOn(int forLevel)
Activates a specific trace level.

Parameters:
forLevel - The trace level to be activated.
 o setOffAll
 public static void setOffAll()
Deactivates all trace levels, so that no debug messages will be printed.

 o setOff
 public static void setOff(int forLevel)
Deactivates a specific trace level.

Parameters:
forLevel - The trace level to be deactivated.
 o setLevel
 public static void setLevel(int l)
Sets the trace level.

Parameters:
l - The new trace level.
 o setDefault
 public static void setDefault(boolean l)
Enables or disables default mode. If default mode is enabled, messages for the selected trace level and messages not associated with a predefined trace level are printed. If default mode is disabled, no messages that are not associated with a predefined trace level are printed. Only messages for the selected trace level are printed.

Parameters:
l - true to enable default mode or false to disable default mode.
 o setLog
 public static void setLog(PrintWriter l)
Sets the log for debug messages. By default debug messages are printed to the standard error stream. If a null reference is passed to this method, the standard error stream is used.

Parameters:
l - The PrintWriter stream to be used for logging debug messages.

All Packages  Class Hierarchy  This Package  Previous  Next  Index