org.jlog2
Class Logger

java.lang.Object
  extended by org.jlog2.Logger

public class Logger
extends java.lang.Object

This class stores log channels appropriate for each Logger instance and provides the methods to log messages to those channels.


Constructor Summary
Logger(java.lang.String thisLoggerID)
          Create a new instance of Logger.
Logger(java.lang.String thisLoggerID, java.lang.String thisClassName)
          Create a new instance of Logger.
 
Method Summary
 void debugError(java.lang.String level, java.lang.Exception error)
          Debug the error on the appropriate channels.
 void debugMessage(java.lang.String level, java.lang.String methodName, java.lang.String message)
          Debug the message on the appropriate channels.
 boolean getDebug()
          Get the value indicating if the debug channels are being used.
 java.lang.String getLoggerID()
          Get the unique id that created this logger.
 void logError(java.lang.String level, java.lang.Exception error)
          Log the error on the appropriate channels.
 void logMessage(java.lang.String level, java.lang.String methodName, java.lang.String message)
          Log the message on the appropriate channels.
 void setDebug(boolean thisDebug)
          Set a value indicating if the debug channels should be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Logger

public Logger(java.lang.String thisLoggerID)
Create a new instance of Logger.

Parameters:
thisLoggerID - the unique logger id.

Logger

public Logger(java.lang.String thisLoggerID,
              java.lang.String thisClassName)
Create a new instance of Logger.

Parameters:
thisLoggerID - the unique logger id.
thisClassName - the classname of the class that uses this logger if different from the logger id.
Method Detail

setDebug

public void setDebug(boolean thisDebug)
Set a value indicating if the debug channels should be used.

Parameters:
thisDebug - true if log a debug trace, false otherwise.

getDebug

public boolean getDebug()
Get the value indicating if the debug channels are being used.

Returns:
the value of debug.

getLoggerID

public java.lang.String getLoggerID()
Get the unique id that created this logger.

Returns:
the value of loggerID.

logMessage

public void logMessage(java.lang.String level,
                       java.lang.String methodName,
                       java.lang.String message)
                throws java.lang.Exception
Log the message on the appropriate channels.

Parameters:
level - the log level for the message, error, warning, etc.
methodName - the name of the method in the class logging the message.
message - the message to log.
Throws:
java.lang.Exception - any error.

debugMessage

public void debugMessage(java.lang.String level,
                         java.lang.String methodName,
                         java.lang.String message)
                  throws java.lang.Exception
Debug the message on the appropriate channels.

Parameters:
level - the log level for the message, error, warning, etc.
methodName - the name of the method in the class logging the message.
message - the message to log.
Throws:
java.lang.Exception - any error.

logError

public void logError(java.lang.String level,
                     java.lang.Exception error)
              throws java.lang.Exception
Log the error on the appropriate channels.

Parameters:
level - the log level for the message, error, warning, etc.
error - the error to log.
Throws:
java.lang.Exception - any error.

debugError

public void debugError(java.lang.String level,
                       java.lang.Exception error)
                throws java.lang.Exception
Debug the error on the appropriate channels.

Parameters:
level - the log level for the message, error, warning, etc.
error - the error to debug.
Throws:
java.lang.Exception - any error.