org.pf.logging
Class NilLogger

java.lang.Object
  extended by org.pf.logging.NilLogger
All Implemented Interfaces:
Logger

public class NilLogger
extends java.lang.Object
implements Logger

This class implements the Logger interface but doesn't write anything to any output device. It could be used to provide a dummy logger implementation for an application that wants to use logging, but has no logging component available (in the classpath).

Version:
1.1
Author:
Manfred Duchrow

Constructor Summary
NilLogger()
          Initialize the new instance with default values.
 
Method Summary
 void initialize(java.util.Properties properties)
          Initialize the logger from the given properties settings.
 boolean isLoggingDebugs()
          Returns true, if debug messages will be written to the output device(s).
 boolean isLoggingErrors()
          Returns true, if errors will be written to the output device(s).
 boolean isLoggingInfos()
          Returns true, if info messages will be written to the output device(s).
 boolean isLoggingWarnings()
          Returns true, if warnings will be written to the output device(s).
 void logDebug(java.lang.String message)
          If the logging level is DEBUG the given message will be written to the log output device(s).
 void logError(java.lang.String message)
          If the logging level is DEBUG, INFO, WARNING or ERROR the given message will be written to the log output device(s).
 void logError(java.lang.String message, java.lang.Throwable exception)
          If the logging level is DEBUG, INFO, WARNING or ERROR the given message and the exception will be written to the log output device(s).
 void logException(java.lang.Throwable ex)
          Writes the given exception to the log output device(s).
 void logInfo(java.lang.String message)
          If the logging level is INFO or DEBUG the given message will be written to the log output device(s).
 void logWarning(java.lang.String message)
          If the logging level is DEBUG, INFO or WARNING the given message will be written to the log output device(s).
 void logWarning(java.lang.String message, java.lang.Throwable exception)
          If the logging level is DEBUG, INFO or WARNING the given message and the exception will be written to the log output device(s).
 boolean setLogLevel(java.lang.String logLevel)
          Changes the log level to the specified level.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NilLogger

public NilLogger()
Initialize the new instance with default values.

Method Detail

initialize

public void initialize(java.util.Properties properties)
Initialize the logger from the given properties settings.

Specified by:
initialize in interface Logger

logException

public void logException(java.lang.Throwable ex)
Writes the given exception to the log output device(s). The log level will be ignored.

Specified by:
logException in interface Logger

logDebug

public void logDebug(java.lang.String message)
If the logging level is DEBUG the given message will be written to the log output device(s).

Specified by:
logDebug in interface Logger

logInfo

public void logInfo(java.lang.String message)
If the logging level is INFO or DEBUG the given message will be written to the log output device(s).

Specified by:
logInfo in interface Logger

logWarning

public void logWarning(java.lang.String message)
If the logging level is DEBUG, INFO or WARNING the given message will be written to the log output device(s).

Specified by:
logWarning in interface Logger

logError

public void logError(java.lang.String message)
If the logging level is DEBUG, INFO, WARNING or ERROR the given message will be written to the log output device(s).

Specified by:
logError in interface Logger

logWarning

public void logWarning(java.lang.String message,
                       java.lang.Throwable exception)
If the logging level is DEBUG, INFO or WARNING the given message and the exception will be written to the log output device(s).

Specified by:
logWarning in interface Logger

logError

public void logError(java.lang.String message,
                     java.lang.Throwable exception)
If the logging level is DEBUG, INFO, WARNING or ERROR the given message and the exception will be written to the log output device(s).

Specified by:
logError in interface Logger

isLoggingDebugs

public boolean isLoggingDebugs()
Returns true, if debug messages will be written to the output device(s).

Specified by:
isLoggingDebugs in interface Logger

isLoggingInfos

public boolean isLoggingInfos()
Returns true, if info messages will be written to the output device(s).

Specified by:
isLoggingInfos in interface Logger

isLoggingWarnings

public boolean isLoggingWarnings()
Returns true, if warnings will be written to the output device(s).

Specified by:
isLoggingWarnings in interface Logger

isLoggingErrors

public boolean isLoggingErrors()
Returns true, if errors will be written to the output device(s).

Specified by:
isLoggingErrors in interface Logger

setLogLevel

public boolean setLogLevel(java.lang.String logLevel)
Changes the log level to the specified level. Returns true if the level is supported and was set, otherwise false.

Specified by:
setLogLevel in interface Logger
Returns:
Always false for this logger