net.spy.memcached.compat.log
Class AbstractLogger

java.lang.Object
  extended by net.spy.memcached.compat.log.AbstractLogger
All Implemented Interfaces:
Logger
Direct Known Subclasses:
DefaultLogger, Log4JLogger, SunLogger

public abstract class AbstractLogger
extends Object
implements Logger

Abstract implementation of Logger providing most of the common framework.


Constructor Summary
protected AbstractLogger(String nm)
          Instantiate the abstract logger.
 
Method Summary
 void debug(Object message)
          Log a message at debug level.
 void debug(Object message, Throwable exception)
          Log a message at debug level.
 void debug(String message, Object... args)
          Log a formatted message at debug level.
 void error(Object message)
          Log a message at error level.
 void error(Object message, Throwable exception)
          Log a message at error level.
 void error(String message, Object... args)
          Log a formatted message at debug level.
 void fatal(Object message)
          Log a message at fatal level.
 void fatal(Object message, Throwable exception)
          Log a message at fatal level.
 void fatal(String message, Object... args)
          Log a formatted message at debug level.
 String getName()
          Get the name of this logger.
 Throwable getThrowable(Object[] args)
          Get the throwable from the last element of this array if it is Throwable, else null.
 void info(Object message)
          Log a message at info level.
 void info(Object message, Throwable exception)
          Log a message at info level.
 void info(String message, Object... args)
          Log a formatted message at info level.
abstract  boolean isDebugEnabled()
          True if debug is enabled for this logger.
abstract  boolean isInfoEnabled()
          True if debug is enabled for this logger.
 void log(Level level, Object message)
          Log a message at the given level.
abstract  void log(Level level, Object message, Throwable e)
          Subclasses should implement this method to determine what to do when a client wants to log at a particular level.
 void warn(Object message)
          Log a message at warning level.
 void warn(Object message, Throwable exception)
          Log a message at warning level.
 void warn(String message, Object... args)
          Log a formatted message at debug level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLogger

protected AbstractLogger(String nm)
Instantiate the abstract logger.

Method Detail

getName

public String getName()
Get the name of this logger.

Specified by:
getName in interface Logger

getThrowable

public Throwable getThrowable(Object[] args)
Get the throwable from the last element of this array if it is Throwable, else null.


isDebugEnabled

public abstract boolean isDebugEnabled()
True if debug is enabled for this logger. Default implementation always returns false

Specified by:
isDebugEnabled in interface Logger
Returns:
true if debug messages would be displayed

isInfoEnabled

public abstract boolean isInfoEnabled()
True if debug is enabled for this logger. Default implementation always returns false

Specified by:
isInfoEnabled in interface Logger
Returns:
true if info messages would be displayed

debug

public void debug(Object message,
                  Throwable exception)
Log a message at debug level.

Specified by:
debug in interface Logger
Parameters:
message - the message to log
exception - the exception that caused the message to be generated

debug

public void debug(String message,
                  Object... args)
Log a formatted message at debug level.

Specified by:
debug in interface Logger
Parameters:
message - the message to log
args - the arguments for that message

debug

public void debug(Object message)
Log a message at debug level.

Specified by:
debug in interface Logger
Parameters:
message - the message to log

info

public void info(Object message,
                 Throwable exception)
Log a message at info level.

Specified by:
info in interface Logger
Parameters:
message - the message to log
exception - the exception that caused the message to be generated

info

public void info(String message,
                 Object... args)
Log a formatted message at info level.

Specified by:
info in interface Logger
Parameters:
message - the message to log
args - the arguments for that message

info

public void info(Object message)
Log a message at info level.

Specified by:
info in interface Logger
Parameters:
message - the message to log

warn

public void warn(Object message,
                 Throwable exception)
Log a message at warning level.

Specified by:
warn in interface Logger
Parameters:
message - the message to log
exception - the exception that caused the message to be generated

warn

public void warn(String message,
                 Object... args)
Log a formatted message at debug level.

Specified by:
warn in interface Logger
Parameters:
message - the message to log
args - the arguments for that message

warn

public void warn(Object message)
Log a message at warning level.

Specified by:
warn in interface Logger
Parameters:
message - the message to log

error

public void error(Object message,
                  Throwable exception)
Log a message at error level.

Specified by:
error in interface Logger
Parameters:
message - the message to log
exception - the exception that caused the message to be generated

error

public void error(String message,
                  Object... args)
Log a formatted message at debug level.

Specified by:
error in interface Logger
Parameters:
message - the message to log
args - the arguments for that message

error

public void error(Object message)
Log a message at error level.

Specified by:
error in interface Logger
Parameters:
message - the message to log

fatal

public void fatal(Object message,
                  Throwable exception)
Log a message at fatal level.

Specified by:
fatal in interface Logger
Parameters:
message - the message to log
exception - the exception that caused the message to be generated

fatal

public void fatal(String message,
                  Object... args)
Log a formatted message at debug level.

Specified by:
fatal in interface Logger
Parameters:
message - the message to log
args - the arguments for that message

fatal

public void fatal(Object message)
Log a message at fatal level.

Specified by:
fatal in interface Logger
Parameters:
message - the message to log

log

public void log(Level level,
                Object message)
Log a message at the given level.

Specified by:
log in interface Logger
Parameters:
level - the level
message - the message

log

public abstract void log(Level level,
                         Object message,
                         Throwable e)
Subclasses should implement this method to determine what to do when a client wants to log at a particular level.

Specified by:
log in interface Logger
Parameters:
level - the level to log at (see the fields of this class)
message - the message to log
e - the exception that caused the message (or null)