Class JulLogAdapter

java.lang.Object
org.apache.commons.jcs3.log.JulLogAdapter
All Implemented Interfaces:
Log

public class JulLogAdapter extends Object implements Log
This is a wrapper around the java.util.logging.Logger implementing our own Log interface.

This is the mapping of the log levels

 Java Level   Log Level
 SEVERE       FATAL
 SEVERE       ERROR
 WARNING      WARN
 INFO         INFO
 FINE         DEBUG
 FINER        TRACE
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a JUL Logger wrapper
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    debug(Object message)
    Logs a message object with the DEBUG level.
    void
    debug(String message)
    Logs a message object with the DEBUG level.
    void
    debug(String message, Object... params)
    Logs a message with parameters at the DEBUG level.
    void
    debug(String message, Throwable t)
    Logs a message at the DEBUG level including the stack trace of the Throwable t passed as parameter.
    void
    debug(String message, Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the DEBUG level.
    void
    error(Object message)
    Logs a message object with the ERROR level.
    void
    error(String message)
    Logs a message object with the ERROR level.
    void
    error(String message, Object... params)
    Logs a message with parameters at the ERROR level.
    void
    error(String message, Throwable t)
    Logs a message at the ERROR level including the stack trace of the Throwable t passed as parameter.
    void
    error(String message, Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the ERROR level.
    void
    fatal(Object message)
    Logs a message object with the FATAL level.
    void
    fatal(String message)
    Logs a message object with the FATAL level.
    void
    fatal(String message, Object... params)
    Logs a message with parameters at the FATAL level.
    void
    fatal(String message, Throwable t)
    Logs a message at the FATAL level including the stack trace of the Throwable t passed as parameter.
    void
    fatal(String message, Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the FATAL level.
    Gets the logger name.
    void
    info(Object message)
    Logs a message object with the INFO level.
    void
    info(String message)
    Logs a message object with the INFO level.
    void
    info(String message, Object... params)
    Logs a message with parameters at the INFO level.
    void
    info(String message, Throwable t)
    Logs a message at the INFO level including the stack trace of the Throwable t passed as parameter.
    void
    info(String message, Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the INFO level.
    boolean
    Checks whether this Logger is enabled for the DEBUG Level.
    boolean
    Checks whether this Logger is enabled for the ERROR Level.
    boolean
    Checks whether this Logger is enabled for the FATAL Level.
    boolean
    Checks whether this Logger is enabled for the INFO Level.
    boolean
    Checks whether this Logger is enabled for the TRACE level.
    boolean
    Checks whether this Logger is enabled for the WARN Level.
    void
    trace(Object message)
    Logs a message object with the TRACE level.
    void
    trace(String message)
    Logs a message object with the TRACE level.
    void
    trace(String message, Object... params)
    Logs a message with parameters at the TRACE level.
    void
    trace(String message, Throwable t)
    Logs a message at the TRACE level including the stack trace of the Throwable t passed as parameter.
    void
    trace(String message, Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the TRACE level.
    void
    warn(Object message)
    Logs a message object with the WARN level.
    void
    warn(String message)
    Logs a message object with the WARN level.
    void
    warn(String message, Object... params)
    Logs a message with parameters at the WARN level.
    void
    warn(String message, Throwable t)
    Logs a message at the WARN level including the stack trace of the Throwable t passed as parameter.
    void
    warn(String message, Supplier<?>... paramSuppliers)
    Logs a message with parameters which are only to be constructed if the logging level is the WARN level.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JulLogAdapter

      public JulLogAdapter(Logger logger)
      Construct a JUL Logger wrapper
      Parameters:
      logger - the JUL Logger
  • Method Details

    • debug

      public void debug(String message)
      Logs a message object with the DEBUG level.
      Specified by:
      debug in interface Log
      Parameters:
      message - the message string to log.
    • debug

      public void debug(Object message)
      Logs a message object with the DEBUG level.
      Specified by:
      debug in interface Log
      Parameters:
      message - the message object to log.
    • debug

      public void debug(String message, Object... params)
      Logs a message with parameters at the DEBUG level.
      Specified by:
      debug in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • debug

      public void debug(String message, Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the DEBUG level.
      Specified by:
      debug in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • debug

      public void debug(String message, Throwable t)
      Logs a message at the DEBUG level including the stack trace of the Throwable t passed as parameter.
      Specified by:
      debug in interface Log
      Parameters:
      message - the message to log.
      t - the exception to log, including its stack trace.
    • error

      public void error(String message)
      Logs a message object with the ERROR level.
      Specified by:
      error in interface Log
      Parameters:
      message - the message string to log.
    • error

      public void error(Object message)
      Logs a message object with the ERROR level.
      Specified by:
      error in interface Log
      Parameters:
      message - the message object to log.
    • error

      public void error(String message, Object... params)
      Logs a message with parameters at the ERROR level.
      Specified by:
      error in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • error

      public void error(String message, Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the ERROR level.
      Specified by:
      error in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
      Since:
      2.4
    • error

      public void error(String message, Throwable t)
      Logs a message at the ERROR level including the stack trace of the Throwable t passed as parameter.
      Specified by:
      error in interface Log
      Parameters:
      message - the message object to log.
      t - the exception to log, including its stack trace.
    • fatal

      public void fatal(String message)
      Logs a message object with the FATAL level.
      Specified by:
      fatal in interface Log
      Parameters:
      message - the message string to log.
    • fatal

      public void fatal(Object message)
      Logs a message object with the FATAL level.
      Specified by:
      fatal in interface Log
      Parameters:
      message - the message object to log.
    • fatal

      public void fatal(String message, Object... params)
      Logs a message with parameters at the FATAL level.
      Specified by:
      fatal in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • fatal

      public void fatal(String message, Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the FATAL level.
      Specified by:
      fatal in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • fatal

      public void fatal(String message, Throwable t)
      Logs a message at the FATAL level including the stack trace of the Throwable t passed as parameter.
      Specified by:
      fatal in interface Log
      Parameters:
      message - the message object to log.
      t - the exception to log, including its stack trace.
    • getName

      public String getName()
      Gets the logger name.
      Specified by:
      getName in interface Log
      Returns:
      the logger name.
    • info

      public void info(String message)
      Logs a message object with the INFO level.
      Specified by:
      info in interface Log
      Parameters:
      message - the message string to log.
    • info

      public void info(Object message)
      Logs a message object with the INFO level.
      Specified by:
      info in interface Log
      Parameters:
      message - the message object to log.
    • info

      public void info(String message, Object... params)
      Logs a message with parameters at the INFO level.
      Specified by:
      info in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • info

      public void info(String message, Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the INFO level.
      Specified by:
      info in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • info

      public void info(String message, Throwable t)
      Logs a message at the INFO level including the stack trace of the Throwable t passed as parameter.
      Specified by:
      info in interface Log
      Parameters:
      message - the message object to log.
      t - the exception to log, including its stack trace.
    • isDebugEnabled

      public boolean isDebugEnabled()
      Checks whether this Logger is enabled for the DEBUG Level.
      Specified by:
      isDebugEnabled in interface Log
      Returns:
      boolean - true if this Logger is enabled for level DEBUG, false otherwise.
    • isErrorEnabled

      public boolean isErrorEnabled()
      Checks whether this Logger is enabled for the ERROR Level.
      Specified by:
      isErrorEnabled in interface Log
      Returns:
      boolean - true if this Logger is enabled for level ERROR, false otherwise.
    • isFatalEnabled

      public boolean isFatalEnabled()
      Checks whether this Logger is enabled for the FATAL Level.
      Specified by:
      isFatalEnabled in interface Log
      Returns:
      boolean - true if this Logger is enabled for level FATAL, false otherwise.
    • isInfoEnabled

      public boolean isInfoEnabled()
      Checks whether this Logger is enabled for the INFO Level.
      Specified by:
      isInfoEnabled in interface Log
      Returns:
      boolean - true if this Logger is enabled for level INFO, false otherwise.
    • isTraceEnabled

      public boolean isTraceEnabled()
      Checks whether this Logger is enabled for the TRACE level.
      Specified by:
      isTraceEnabled in interface Log
      Returns:
      boolean - true if this Logger is enabled for level TRACE, false otherwise.
    • isWarnEnabled

      public boolean isWarnEnabled()
      Checks whether this Logger is enabled for the WARN Level.
      Specified by:
      isWarnEnabled in interface Log
      Returns:
      boolean - true if this Logger is enabled for level WARN, false otherwise.
    • trace

      public void trace(String message)
      Logs a message object with the TRACE level.
      Specified by:
      trace in interface Log
      Parameters:
      message - the message string to log.
    • trace

      public void trace(Object message)
      Logs a message object with the TRACE level.
      Specified by:
      trace in interface Log
      Parameters:
      message - the message object to log.
    • trace

      public void trace(String message, Object... params)
      Logs a message with parameters at the TRACE level.
      Specified by:
      trace in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • trace

      public void trace(String message, Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the TRACE level.
      Specified by:
      trace in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • trace

      public void trace(String message, Throwable t)
      Logs a message at the TRACE level including the stack trace of the Throwable t passed as parameter.
      Specified by:
      trace in interface Log
      Parameters:
      message - the message object to log.
      t - the exception to log, including its stack trace.
      See Also:
    • warn

      public void warn(String message)
      Logs a message object with the WARN level.
      Specified by:
      warn in interface Log
      Parameters:
      message - the message string to log.
    • warn

      public void warn(Object message)
      Logs a message object with the WARN level.
      Specified by:
      warn in interface Log
      Parameters:
      message - the message object to log.
    • warn

      public void warn(String message, Object... params)
      Logs a message with parameters at the WARN level.
      Specified by:
      warn in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      params - parameters to the message.
    • warn

      public void warn(String message, Supplier<?>... paramSuppliers)
      Logs a message with parameters which are only to be constructed if the logging level is the WARN level.
      Specified by:
      warn in interface Log
      Parameters:
      message - the message to log; the format depends on the message factory.
      paramSuppliers - An array of functions, which when called, produce the desired log message parameters.
    • warn

      public void warn(String message, Throwable t)
      Logs a message at the WARN level including the stack trace of the Throwable t passed as parameter.
      Specified by:
      warn in interface Log
      Parameters:
      message - the message object to log.
      t - the exception to log, including its stack trace.