dd.util
Class Logger

java.lang.Object
  extended bydd.util.Logger

public class Logger
extends java.lang.Object

Provides support for logging and error messages. All logging messages eventually go through this object for storage. Logging is very simple but can be customized through changes to the implementation in this class.

There are four levels of logging provided by this class, in increasing order of severity:

Note that you should never create an instance of the logger, since all code should share the same log (to simplify synchronization problems). Instead, you can get the current log for this application by calling the static getDefaultLog() factory method.

There are constants defined in this file that can be modified if you wish to suppress or activiate various levels of log messages.

Author:
Eric Scharff

Field Summary
static boolean LOG_DEBUG
          Determines whether debug() calls should appear in the log.
static boolean LOG_ERROR
          Determines whether error() calls should appear in the log.
static boolean LOG_LOG
          Determines whether log() calls should appear in the log.
static boolean LOG_WARNING
          Determines whether warning() calls should appear in the log.
 
Method Summary
 void debug(java.lang.String debugMessage)
          Logs a debugging message.
 void error(java.lang.String errorMessage)
          Logs an error message.
static Logger getDefaultLog()
          Returns the current application's logger.
 void log(java.lang.String logMessage)
          Logs a logging message.
 void setOutput(java.io.File outFile)
           
 void warning(java.lang.String warningMessage)
          Logs a warning message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_DEBUG

public static final boolean LOG_DEBUG
Determines whether debug() calls should appear in the log.

See Also:
Constant Field Values

LOG_LOG

public static final boolean LOG_LOG
Determines whether log() calls should appear in the log.

See Also:
Constant Field Values

LOG_WARNING

public static final boolean LOG_WARNING
Determines whether warning() calls should appear in the log.

See Also:
Constant Field Values

LOG_ERROR

public static final boolean LOG_ERROR
Determines whether error() calls should appear in the log.

See Also:
Constant Field Values
Method Detail

getDefaultLog

public static Logger getDefaultLog()
Returns the current application's logger. This factory method ensures that there is only one instance of the log per application, which dramatically simplifies synchronization and locking issues.

Returns:
the log for the currently running virtual machine

setOutput

public void setOutput(java.io.File outFile)
               throws java.io.IOException
Throws:
java.io.IOException

debug

public void debug(java.lang.String debugMessage)
Logs a debugging message. This is the lowest priority logging message and is used as an aid to debugging.

Parameters:
debugMessage - descriptive text for the log

log

public void log(java.lang.String logMessage)
Logs a logging message. This is a moderate priority message that is used to log normal behavior.

Parameters:
logMessage - descriptive text for the log

warning

public void warning(java.lang.String warningMessage)
Logs a warning message. this is a high priority message that indicates that an unexpected condition (error) occurred, but that the system is attempting to recover from the error. An example would be a caught exception. The phrase WARNING and the file name and line number are included as part of the logged message.

Parameters:
warningMessage - descriptive text for the log

error

public void error(java.lang.String errorMessage)
Logs an error message. This is the highest priority message and indicates that an unrecoverable error has occurred. Execution may terminate shortly after a call to this method. The phrase ERROR and the file name and line number are included as part of the logged message.

Parameters:
errorMessage - descriptive text for the log