Class AbstractLogger

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

public abstract class AbstractLogger extends Object implements Logger
Abstract implementation of Logger providing most of the common framework.
  • Field Details

    • name

      private final String name
  • Constructor Details

    • AbstractLogger

      protected AbstractLogger(String nm)
      Instantiate the abstract logger.
  • Method Details

    • 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
    • trace

      public void trace(Object message, Throwable exception)
      Log a message at trace level.
      Specified by:
      trace in interface Logger
      Parameters:
      message - the message to log
      exception - the exception that caused the message to be generated
    • trace

      public void trace(String message, Object... args)
      Log a formatted message at trace level.
      Specified by:
      trace in interface Logger
      Parameters:
      message - the message to log
      args - the arguments for that message
    • trace

      public void trace(Object message)
      Log a message at trace level.
      Specified by:
      trace in interface Logger
      Parameters:
      message - the message to log
    • 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)