|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.log.Log
Globally controls generating of logging messages.
Each application consists of logical parts which we will call here the application
subsystems. A graphical user interface can be the application subsystem as well as a
monitoring agent, for example. Let's say that we identify these two subsystems by two string
constants - "gui" and "monitor". The Log static class provides a way
how to enable or disable generating of debugging messages (i.e. messages with the LOG_DEBUG
level) as well as the tracing messages (messages
with the LOG_TRACE
level) for the particular
application subsystems, identified by these string constants.
By disabling the log messages you can save the system resources as well as speed-up the overall application performance. On the other hand, enabling them gives you a more detailed information about the activity of the particular application subsystem.
The setDebug(String)
and getDebug(String)
static methods can be used to
enable or disable generating of debugging messages for an application subsystem. Therefore
the setDebug method accepts a space-separated list of strings, identifying the
particular subsystems.
A sample use of the setDebug(String)
and getDebug(String)
methods:
// enable debugging messages for generic TCP/IP services and SMTP server: Log.setDebug("tcpip, smtp"); // this message WILL be generated: if (Log.getDebug("smtp")) log(LOG_DEBUG, "SMTP ready to serve.)); // this message WILL NOT be generated: if (Log.getDebug("http")) log(LOG_DEBUG, "HTTP ready to serve, too.)); // disable generating of any debugging messages: Log.setDebug(""); // this message WILL NOT be generated: if (Log.getDebug("snmp")) log(LOG_DEBUG, "SNMP ready to serve hopefully.));
The setTrace(String)
and getTrace(String)
methods work analogically for
the log messages with the Service.LOG_TRACE
logging level.
The following subsystem identifiers are reserved by the core Dwarf framework and can be controlled via this class:
setDebug(String)
or setTrace(String)
method you can increase the global verbosity of the log messages generated by the application.
Other Dwarf-based applications may use their own subsystem identifiers, as "http" for the Dwarf HTTP Server, for example.
Method Summary | |
static java.util.Set |
getDebug()
Returns the subsystem identifiers for the debugging messages. |
static boolean |
getDebug(java.lang.String id)
Whether the debugging messages are enabled for the given subsystem identifier. |
static java.util.Set |
getTrace()
Returns the subsystem identifiers for the tracing messages. |
static boolean |
getTrace(java.lang.String id)
Whether the tracing messages are enabled for the given subsystem identifier. |
static void |
setDebug(java.lang.String identifiers)
Enables debugging messages for the given subsystem identifiers. |
static void |
setTrace(java.lang.String identifiers)
Enables tracing messages for the given subsystem identifiers. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.util.Set getDebug()
It returns the set of string subsystem identifiers for which the debugging messages are currently enabled.
setDebug(String)
public static boolean getDebug(java.lang.String id)
id
- the subsystem identifier
setDebug(String)
public static void setDebug(java.lang.String identifiers)
A comma-separated list of string constants identifying the particular application subsystems should be used as an argument.
If a security manager is installed, the ServicePermission "setDebug" is checked first.
identifiers
- the subsystem identifiersgetDebug()
,
getDebug(String)
public static java.util.Set getTrace()
It returns the set of string subsystem identifiers for which the tracing messages are currently enabled.
setTrace(String)
public static boolean getTrace(java.lang.String id)
id
- the subsystem identifier
setTrace(String)
public static void setTrace(java.lang.String identifiers)
A comma-separated list of string constants identifying the particular application subsystems should be used as an argument.
If a security manager is installed, the ServicePermission "setTrace" is checked first.
identifiers
- the subsystem identifiersgetTrace()
,
getTrace(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |