Class CommonsLogger

  • All Implemented Interfaces:
    Logger

    public class CommonsLogger
    extends java.lang.Object
    implements Logger
    An Avalon Logger implementation backed by a of commons lLogging.
    Since:
    4.3
    Version:
    $Id: CommonsLogger.java 233132 2005-08-17 02:32:45 -0500 (Wed, 17 Aug 2005) cziegeler $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.apache.commons.logging.Log log  
      private java.lang.String name  
    • Constructor Summary

      Constructors 
      Constructor Description
      CommonsLogger​(org.apache.commons.logging.Log log, java.lang.String name)
      Construct a CommonsLogger.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug​(java.lang.String message)
      Log a debug message.
      void debug​(java.lang.String message, java.lang.Throwable throwable)
      Log a debug message.
      void error​(java.lang.String message)
      Log a error message.
      void error​(java.lang.String message, java.lang.Throwable throwable)
      Log a error message.
      void fatalError​(java.lang.String message)
      Log a fatalError message.
      void fatalError​(java.lang.String message, java.lang.Throwable throwable)
      Log a fatalError message.
      Logger getChildLogger​(java.lang.String name)
      Create a new child logger.
      void info​(java.lang.String message)
      Log a info message.
      void info​(java.lang.String message, java.lang.Throwable throwable)
      Log a info message.
      boolean isDebugEnabled()
      Determine if messages of priority "debug" will be logged.
      boolean isErrorEnabled()
      Determine if messages of priority "error" will be logged.
      boolean isFatalErrorEnabled()
      Determine if messages of priority "fatalError" will be logged.
      boolean isInfoEnabled()
      Determine if messages of priority "info" will be logged.
      boolean isWarnEnabled()
      Determine if messages of priority "warn" will be logged.
      void warn​(java.lang.String message)
      Log a warn message.
      void warn​(java.lang.String message, java.lang.Throwable throwable)
      Log a warn message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        private final org.apache.commons.logging.Log log
      • name

        private final java.lang.String name
    • Constructor Detail

      • CommonsLogger

        public CommonsLogger​(org.apache.commons.logging.Log log,
                             java.lang.String name)
        Construct a CommonsLogger. The constructor needs explicitly the name of the commons-logger, since the commons-logging API misses the functionality to retrieve it from the logger instance.
        Parameters:
        log - The logger of commons-logging.
        name - The name of the logger.
        Since:
        2.0
    • Method Detail

      • debug

        public void debug​(java.lang.String message)
        Description copied from interface: Logger
        Log a debug message.
        Specified by:
        debug in interface Logger
        Parameters:
        message - the message
        See Also:
        Logger.debug(java.lang.String)
      • isDebugEnabled

        public boolean isDebugEnabled()
        Description copied from interface: Logger
        Determine if messages of priority "debug" will be logged.
        Specified by:
        isDebugEnabled in interface Logger
        Returns:
        true if "debug" messages will be logged
        See Also:
        Logger.isDebugEnabled()
      • info

        public void info​(java.lang.String message)
        Description copied from interface: Logger
        Log a info message.
        Specified by:
        info in interface Logger
        Parameters:
        message - the message
        See Also:
        Logger.info(java.lang.String)
      • isInfoEnabled

        public boolean isInfoEnabled()
        Description copied from interface: Logger
        Determine if messages of priority "info" will be logged.
        Specified by:
        isInfoEnabled in interface Logger
        Returns:
        true if "info" messages will be logged
        See Also:
        Logger.isInfoEnabled()
      • warn

        public void warn​(java.lang.String message)
        Description copied from interface: Logger
        Log a warn message.
        Specified by:
        warn in interface Logger
        Parameters:
        message - the message
        See Also:
        Logger.warn(java.lang.String)
      • isWarnEnabled

        public boolean isWarnEnabled()
        Description copied from interface: Logger
        Determine if messages of priority "warn" will be logged.
        Specified by:
        isWarnEnabled in interface Logger
        Returns:
        true if "warn" messages will be logged
        See Also:
        Logger.isWarnEnabled()
      • error

        public void error​(java.lang.String message)
        Description copied from interface: Logger
        Log a error message.
        Specified by:
        error in interface Logger
        Parameters:
        message - the message
        See Also:
        Logger.error(java.lang.String)
      • isErrorEnabled

        public boolean isErrorEnabled()
        Description copied from interface: Logger
        Determine if messages of priority "error" will be logged.
        Specified by:
        isErrorEnabled in interface Logger
        Returns:
        true if "error" messages will be logged
        See Also:
        Logger.isErrorEnabled()
      • isFatalErrorEnabled

        public boolean isFatalErrorEnabled()
        Description copied from interface: Logger
        Determine if messages of priority "fatalError" will be logged.
        Specified by:
        isFatalErrorEnabled in interface Logger
        Returns:
        true if "fatalError" messages will be logged
        See Also:
        Logger.isFatalErrorEnabled()
      • getChildLogger

        public Logger getChildLogger​(java.lang.String name)
        Description copied from interface: Logger
        Create a new child logger. The name of the child logger is [current-loggers-name].[passed-in-name] Throws IllegalArgumentException if name has an empty element name
        Specified by:
        getChildLogger in interface Logger
        Parameters:
        name - the subname of this logger
        Returns:
        the new logger
        See Also:
        Logger.getChildLogger(java.lang.String)