gnu.hylafax.logging
Class Log4jLogger

java.lang.Object
  |
  +--gnu.hylafax.logging.Log4jLogger
All Implemented Interfaces:
Logger

public class Log4jLogger
extends java.lang.Object
implements Logger

Implements a logging factory that uses log4j if it is available. If log4 is not available then output is logged to the console via System.out. It is possible to change the PrintStream / OutputStream of the console logger Future enhancements could include adding support for java.util.logging. However, there would have to be some mechanism for determining which method to use. The current implementation only uses the console logger if log4j is not available. log4j can be found at http://logging.apache.org

Author:
Steven Jardine

Constructor Summary
protected Log4jLogger(java.lang.Class logClass)
          Creates a logger using the class requesting logging.
protected Log4jLogger(java.lang.String logClassName)
          Creates a logger using the class name requesting logging.
 
Method Summary
 void debug(java.lang.Object message)
          Log a debug message.
 void debug(java.lang.Object message, java.lang.Throwable t)
          Log a debug message with an exception.
 void error(java.lang.Object message)
          Log an error message.
 void error(java.lang.Object message, java.lang.Throwable t)
          Log an error message with an exception.
 void fatal(java.lang.Object message)
          Log a fatal message.
 void fatal(java.lang.Object message, java.lang.Throwable t)
          Log a fatal message with an exception.
 void info(java.lang.Object message)
          Log an info message.
 void info(java.lang.Object message, java.lang.Throwable t)
          Log an info message with an exception.
 boolean isDebugEnabled()
           
 boolean isErrorEnabled()
           
 boolean isFatalEnabled()
           
 boolean isInfoEnabled()
           
 boolean isWarnEnabled()
           
 void warn(java.lang.Object message)
          Log a warn message.
 void warn(java.lang.Object message, java.lang.Throwable t)
          Log a warn message with an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log4jLogger

protected Log4jLogger(java.lang.Class logClass)
Creates a logger using the class requesting logging.
Parameters:
logClass - The class that is requesting logging.

Log4jLogger

protected Log4jLogger(java.lang.String logClassName)
               throws java.lang.ClassNotFoundException
Creates a logger using the class name requesting logging.
Parameters:
logClassName - The name of the class requesting logging.
Throws:
java.lang.ClassNotFoundException -  
Method Detail

debug

public void debug(java.lang.Object message)
Description copied from interface: Logger
Log a debug message.
Specified by:
debug in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  

debug

public void debug(java.lang.Object message,
                  java.lang.Throwable t)
Description copied from interface: Logger
Log a debug message with an exception.
Specified by:
debug in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  
t -  

error

public void error(java.lang.Object message)
Description copied from interface: Logger
Log an error message.
Specified by:
error in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  

error

public void error(java.lang.Object message,
                  java.lang.Throwable t)
Description copied from interface: Logger
Log an error message with an exception.
Specified by:
error in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  
t -  

fatal

public void fatal(java.lang.Object message)
Description copied from interface: Logger
Log a fatal message.
Specified by:
fatal in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  

fatal

public void fatal(java.lang.Object message,
                  java.lang.Throwable t)
Description copied from interface: Logger
Log a fatal message with an exception.
Specified by:
fatal in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  
t -  

info

public void info(java.lang.Object message)
Description copied from interface: Logger
Log an info message.
Specified by:
info in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  

info

public void info(java.lang.Object message,
                 java.lang.Throwable t)
Description copied from interface: Logger
Log an info message with an exception.
Specified by:
info in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  
t -  

isDebugEnabled

public boolean isDebugEnabled()
Specified by:
isDebugEnabled in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Returns:
true is debug level is enabled.

isErrorEnabled

public boolean isErrorEnabled()
Specified by:
isErrorEnabled in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Returns:
true is error level is enabled.

isFatalEnabled

public boolean isFatalEnabled()
Specified by:
isFatalEnabled in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Returns:
true is fatal level is enabled.

isInfoEnabled

public boolean isInfoEnabled()
Specified by:
isInfoEnabled in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Returns:
true is info level is enabled.

isWarnEnabled

public boolean isWarnEnabled()
Specified by:
isWarnEnabled in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Returns:
true is warn level is enabled.

warn

public void warn(java.lang.Object message)
Description copied from interface: Logger
Log a warn message.
Specified by:
warn in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  

warn

public void warn(java.lang.Object message,
                 java.lang.Throwable t)
Description copied from interface: Logger
Log a warn message with an exception.
Specified by:
warn in interface Logger
Following copied from interface: gnu.hylafax.logging.Logger
Parameters:
message -  
t -