Interface Logger

All Known Implementing Classes:
AbstractLogger, DefaultLogger, Log4JLogger, SLF4JLogger, SunLogger

public interface Logger
Abstract mechanism for dealing with logs from various objects. Implementations are expected to have a constructor that takes a single String representing the name of the logging item, or an empty constructor.
See Also:
  • Method Details

    • getName

      String getName()
      Get the name of this logger.
    • isDebugEnabled

      boolean isDebugEnabled()
      Checks whether DEBUG logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:
      
      if (log.isDebugEnabled()) {
        ... expensive code here ...
        log.debug(result);
      }
       
      Returns:
      true if debug messages would be displayed.
    • isInfoEnabled

      boolean isInfoEnabled()
      Checks whether INFO logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:
      
      if (log.isInfoEnabled()) {
        ... expensive code here ...
        log.info(result);
      }
       
      Returns:
      true if info messages would be displayed.
    • isTraceEnabled

      boolean isTraceEnabled()
      Checks whether TRACE logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:
      
      if (log.isTraceEnabled()) {
        ... expensive code here ...
        log.trace(result);
      }
       
      Returns:
      true if trace messages would be displayed.
    • log

      void log(Level level, Object message, Throwable exception)
      Log a message at the specified level.
      Parameters:
      level - the level at which to log
      message - the message to log
      exception - an exception that caused the message
    • log

      void log(Level level, Object message)
      Log a message at the specified level.
      Parameters:
      level - the level at which to log
      message - the message to log
    • trace

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

      void trace(Object message)
      Log a message at trace level.
      Parameters:
      message - the message to log
    • trace

      void trace(String message, Object... args)
      Log a formatted message at trace level.
      Parameters:
      message - the message to log
      args - the arguments for that message
    • debug

      void debug(Object message, Throwable exception)
      Log a message at debug level.
      Parameters:
      message - the message to log
      exception - the exception that caused the message to be generated
    • debug

      void debug(Object message)
      Log a message at debug level.
      Parameters:
      message - the message to log
    • debug

      void debug(String message, Object... args)
      Log a formatted message at debug level.
      Parameters:
      message - the message to log
      args - the arguments for that message
    • info

      void info(Object message, Throwable exception)
      Log a message at info level.
      Parameters:
      message - the message to log
      exception - the exception that caused the message to be generated
    • info

      void info(Object message)
      Log a message at info level.
      Parameters:
      message - the message to log
    • info

      void info(String message, Object... args)
      Log a formatted message at info level.
      Parameters:
      message - the message to log
      args - the arguments for that message
    • warn

      void warn(Object message, Throwable exception)
      Log a message at warning level.
      Parameters:
      message - the message to log
      exception - the exception that caused the message to be generated
    • warn

      void warn(Object message)
      Log a message at warning level.
      Parameters:
      message - the message to log
    • warn

      void warn(String message, Object... args)
      Log a formatted message at debug level.
      Parameters:
      message - the message to log
      args - the arguments for that message
    • error

      void error(Object message, Throwable exception)
      Log a message at error level.
      Parameters:
      message - the message to log
      exception - the exception that caused the message to be generated
    • error

      void error(Object message)
      Log a message at error level.
      Parameters:
      message - the message to log
    • error

      void error(String message, Object... args)
      Log a formatted message at debug level.
      Parameters:
      message - the message to log
      args - the arguments for that message
    • fatal

      void fatal(Object message, Throwable exception)
      Log a message at fatal level.
      Parameters:
      message - the message to log
      exception - the exception that caused the message to be generated
    • fatal

      void fatal(Object message)
      Log a message at fatal level.
      Parameters:
      message - the message to log
    • fatal

      void fatal(String message, Object... args)
      Log a formatted message at debug level.
      Parameters:
      message - the message to log
      args - the arguments for that message