com.novell.emframe.dev
Class D

java.lang.Object
  extended bycom.novell.emframe.dev.D

public class D
extends java.lang.Object

Provides a simple mechanism for plugins to log debug messages. The writing of the log occurs asynchronously: the log methods simply queue the event and return immediately while the actual writing is done later by a separate thread. Three levels of logging are supported: ERROR, WARNING and INFO. Only messages with a priority greater than or equal to the current level are logged, those with a lower priority are discarded. Adminstrators can configure the current logging level.

The logging is controlled through the webapps/nps/WEB-INF/Config.xml as follows:

System.Logging
Valid values: true | false.
true enables logging, false disables logging.
System.Logging.Priority
Valid values: 0 = No Logging | 1 = Error | 2 = Warning | 3 = Info.
Sets the logging level. Only messages of this priority level or higher will be logged with "Info" seeing all messages.
System.Logging.Output
Valid values (multiple values allowed): file | err | out
Comma-separated list of output options. If no values are specified, defaults to file.
err logs to System.err, out logs to System.out, file logs to file specified by "System.Logging.File".
System.Logging.File
The filename of the log file - defaults to "debug.xml".
The file is located in the WEB-INF subdirectory of the servlet context, (i.e. . . .\webapps\nps\WEB-INF) and the log records are formatted as XML elements.

Output to a file is written as XML, with one <log> element enclosing multiple <entry src=""> elements, where the src attribute specifies the source tag. The final </log> needs to be added manually before the file can be displayed with an XML\XSL capable tool. Of course, the file can always be viewed with any text editor.


Field Summary
static int ERROR
          Priority level ERROR, highest priority level.
static int INFO
          Priority level INFO, lowest priority.
static int WARNING
          Priority level WARNING.
 
Constructor Summary
D()
           
 
Method Summary
static void assrt(boolean conditional, java.lang.String message)
          Test that a condition is true.
static boolean isDebugEnabled()
          Checks if debug is enabled for the INFO (low) level.
static boolean isDebugEnabled(int iLevel)
          Checks if debug is enabled for the level passed in.
static void log(org.jdom.Document doc)
          Logs a JDOM XML document with INFO(low) level.
static void log(org.w3c.dom.Document doc)
          Logs a W3C XML document with INFO (low) level.
static void log(org.jdom.Document doc, int level)
          Logs a JDOM XML document with the specified level.
static void log(org.w3c.dom.Document doc, int level)
          Logs a W3C XML document with the specified level.
static void log(java.lang.String sString)
          Logs a message with priority INFO (low) and tag "unknown".
static void log(java.lang.String sString, int iLevel)
          Logs a message if the current level is equal to or lower than a specified level.
static void log(java.lang.Throwable e)
          Logs an Exception with priority INFO (low).
static void log(java.lang.Throwable e, int msgLevel, int stackTraceLevel)
          Logs an Exception with priority specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
Priority level ERROR, highest priority level.

ERROR = 1

See Also:
Constant Field Values

INFO

public static final int INFO
Priority level INFO, lowest priority.

LOG_LOW = 3

See Also:
Constant Field Values

WARNING

public static final int WARNING
Priority level WARNING.

WARNING = 2

See Also:
Constant Field Values
Constructor Detail

D

public D()
Method Detail

assrt

public static final void assrt(boolean conditional,
                               java.lang.String message)
Test that a condition is true. If the condition is not true, a message and the stacktrace is logged.

Parameters:
conditional - boolean statement that if evaluated to be false the message will be logged, otherwise nothing will be logged
message - message to be displayed if the condition is false

isDebugEnabled

public static boolean isDebugEnabled()
Checks if debug is enabled for the INFO (low) level.

Returns:
true if logging is turned on and the logging is INFO or higher

isDebugEnabled

public static boolean isDebugEnabled(int iLevel)
Checks if debug is enabled for the level passed in.

Parameters:
iLevel - The level to check if it is currently being logged (HIGH, WARNING, INFO)
Returns:
true if logging is turned on and the logging level would log the message.

log

public static final void log(org.jdom.Document doc)
Logs a JDOM XML document with INFO(low) level.

Parameters:
doc - xml document to log

log

public static final void log(org.w3c.dom.Document doc)
Logs a W3C XML document with INFO (low) level.

Parameters:
doc - xml document to log

log

public static final void log(org.jdom.Document doc,
                             int level)
Logs a JDOM XML document with the specified level.

Parameters:
doc - xml document to log
level - logging level (ERROR, WARNING, or INFO)

log

public static final void log(org.w3c.dom.Document doc,
                             int level)
Logs a W3C XML document with the specified level.

Parameters:
doc - xml document to log
level - logging level (ERROR, WARNING, or INFO)

log

public static void log(java.lang.String sString)
Logs a message with priority INFO (low) and tag "unknown". Logging only occurs if the current level is INFO (low).

Parameters:
sString - the message to log

log

public static void log(java.lang.String sString,
                       int iLevel)
Logs a message if the current level is equal to or lower than a specified level.

Parameters:
sString - the message to log
iLevel - the priority level (ERROR, WARNING, or INFO)

log

public static void log(java.lang.Throwable e)
Logs an Exception with priority INFO (low). Logging only occurs if the current level is INFO (low).

Parameters:
e - the Exception to log

log

public static void log(java.lang.Throwable e,
                       int msgLevel,
                       int stackTraceLevel)
Logs an Exception with priority specified. The stackTraceLevel specifies the priority of the stack trace.

Parameters:
e - the Exception to log
msgLevel - ERROR, WARNING, INFO
stackTraceLevel - ERROR, WARNING, INFO


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.