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:
- By specifying system properties in the command to start the Java
interpreter when you run a class. In this case, the code of the class must
include a call to the
parseDebugProperties method of this
class.
- By specifying the trace level in the code.
The system properties for specifying a trace level are:
| Property | Trace Level |
DEBUG | All messages |
DEFAULT | Messages that are not associated
with a predefined trace level |
DEBUG_CMF | Messages from the framework |
DEBUG_ADA | Messages from the adaptors |
DEBUG_EXCPT | Exceptions |
DEBUG_REPO | Messages from the repository
service |
DEBUG_META | Messages from the metadata
service |
DEBUG_RELA | Messages from the relationship
service |
DEBUG_MLET | Messages from the m-let
service |
DEBUG_SNMP | Messages from the SNMP Manager
service |
DEBUG_DISCO | Messages 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.
-
ADP_DEBUG
- Trace level for the adaptors.
-
CMF_DEBUG
- Trace level for the framework.
-
DISCO_DEBUG
- Trace level for the discovery service.
-
EXCPT_DEBUG
- Trace level for exceptions.
-
HEAVY_DEBUG
- Trace level for getting very talkative traces.
-
META_DEBUG
- Trace level for the metadata service.
-
MLET_DEBUG
- Trace level for the m-let service.
-
NO_DEBUG
- No trace.
-
REL_DEBUG
- Trace level for relationship service.
-
REP_DEBUG
- Trace level for the repository service.
-
SNMP_DEBUG
- Trace level for the Snmp Manager service.
-
TRACE_DEBUG
- Trace level for any class.
-
Debug()
-
-
flush()
- Flushes the trace stream.
-
getLevel()
- Gets the currently selected trace levels.
-
getLog()
- Gets the current log used for logging debug messages.
-
isLevelSet(int)
- Check if
atLevel is set.
-
parseDebugProperties()
- Parses the system properties specified at the command-line to determine
the specified trace level.
-
print(boolean, Object)
- Traces an object according a condition.
-
print(int, Object)
- Traces an object with a specific trace level.
-
print(Object)
- Traces an object.
-
printException(Exception)
- Traces an exception.
-
printFormatted(Object)
- Write a message on the printer stream associated with the
Debug
object.
-
println(boolean, Object)
- Traces an object according a condition and appends a carriage return.
-
println(int, Object)
- Traces an object with a specific level and appends a carriage return.
-
println(Object)
- Traces an object and appends a carriage return.
-
setDefault(boolean)
- Enables or disables default mode.
-
setLevel(int)
- Sets the trace level.
-
setLog(PrintWriter)
- Sets the log for debug messages.
-
setOff(int)
- Deactivates a specific trace level.
-
setOffAll()
- Deactivates all trace levels, so that no debug messages will be
printed.
-
setOn(int)
- Activates a specific trace level.
-
setOnAll()
- Activates all trace levels, so that debug messages for all traces will be
printed.
NO_DEBUG
public static final int NO_DEBUG
- No trace.
CMF_DEBUG
public static final int CMF_DEBUG
- Trace level for the framework. Corresponds to the
DEBUG_CMF
system property.
ADP_DEBUG
public static final int ADP_DEBUG
- Trace level for the adaptors. Corresponds to the
DEBUG_ADA
system property.
REP_DEBUG
public static final int REP_DEBUG
- Trace level for the repository service. Corresponds to the
DEBUG_REPO system property.
EXCPT_DEBUG
public static final int EXCPT_DEBUG
- Trace level for exceptions. Corresponds to the
DEBUG_EXCPT
system property.
META_DEBUG
public static final int META_DEBUG
- Trace level for the metadata service. Corresponds to the
DEBUG_META system property.
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.
REL_DEBUG
public static final int REL_DEBUG
- Trace level for relationship service. Corresponds to the
DEBUG_RELA system property.
MLET_DEBUG
public static final int MLET_DEBUG
- Trace level for the m-let service. Corresponds to the
DEBUG_MLET system property.
DISCO_DEBUG
public static final int DISCO_DEBUG
- Trace level for the discovery service. Corresponds to the
DEBUG_DISCO system property.
SNMP_DEBUG
public static final int SNMP_DEBUG
- Trace level for the Snmp Manager service. Corresponds to the
DEBUG_SNMP system property.
HEAVY_DEBUG
public static final int HEAVY_DEBUG
- Trace level for getting very talkative traces.
DEBUG_HEAVY system property.
Debug
public Debug()
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.
flush
public static void flush()
- Flushes the trace stream.
print
public static void print(Object arg)
- Traces an object.
If the default mode is disabled, nothing is printed.
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.
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.
println
public static void println(Object arg)
- Traces an object and appends a carriage return.
If the default mode is disabled nothing is printed.
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.
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.
printException
public static void printException(Exception e)
- Traces an exception.
If the trace level
EXCPT_DEBUG is not activated,
nothing is printed.
parseDebugProperties
public static void parseDebugProperties()
- Parses the system properties specified at the command-line to determine
the specified trace level.
isLevelSet
public static boolean isLevelSet(int atLevel)
- Check if
atLevel is set.
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.
getLog
public static PrintWriter getLog()
- Gets the current log used for logging debug messages.
- Returns:
- The current
PrintWriter stream used for logging
debug messages.
setOnAll
public static void setOnAll()
- Activates all trace levels, so that debug messages for all traces will be
printed.
setOn
public static void setOn(int forLevel)
- Activates a specific trace level.
- Parameters:
- forLevel - The trace level to be activated.
setOffAll
public static void setOffAll()
- Deactivates all trace levels, so that no debug messages will be
printed.
setOff
public static void setOff(int forLevel)
- Deactivates a specific trace level.
- Parameters:
- forLevel - The trace level to be deactivated.
setLevel
public static void setLevel(int l)
- Sets the trace level.
- Parameters:
- l - The new trace level.
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.
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