Class ConsoleLogger

java.lang.Object
org.apache.avalon.framework.logger.ConsoleLogger
All Implemented Interfaces:
Logger

public final class ConsoleLogger extends Object implements Logger
Logger sending everything to the standard output streams. This is mainly for the cases when you have a utility that does not have a logger to supply.
Version:
CVS $Revision: 1.14 $ $Date: 2004/02/11 14:34:26 $
Author:
Avalon Development Team
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Typecode for debugging messages.
    static final int
    Typecode for disabled log levels.
    static final int
    Typecode for error messages.
    static final int
    Typecode for fatal error messages.
    static final int
    Typecode for informational messages.
    static final int
    Typecode for warning messages.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new ConsoleLogger with the priority set to DEBUG.
    ConsoleLogger(int logLevel)
    Creates a new ConsoleLogger.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    debug(String message)
    Logs a debugging message.
    void
    debug(String message, Throwable throwable)
    Logs a debugging message and an exception.
    void
    error(String message)
    Logs an error message.
    void
    error(String message, Throwable throwable)
    Logs an error message and an exception.
    void
    fatalError(String message)
    Logs a fatal error message.
    void
    fatalError(String message, Throwable throwable)
    Logs a fatal error message and an exception.
    Just returns this logger (ConsoleLogger is not hierarchical).
    void
    info(String message)
    Logs an informational message.
    void
    info(String message, Throwable throwable)
    Logs an informational message and an exception.
    boolean
    Returns true if debug-level logging is enabled, false otherwise.
    boolean
    Returns true if error-level logging is enabled, false otherwise.
    boolean
    Returns true if fatal-level logging is enabled, false otherwise.
    boolean
    Returns true if info-level logging is enabled, false otherwise.
    boolean
    Returns true if warn-level logging is enabled, false otherwise.
    void
    warn(String message)
    Logs a warning message.
    void
    warn(String message, Throwable throwable)
    Logs a warning message and an exception.

    Methods inherited from class java.lang.Object

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

    • LEVEL_DEBUG

      public static final int LEVEL_DEBUG
      Typecode for debugging messages.
      See Also:
    • LEVEL_INFO

      public static final int LEVEL_INFO
      Typecode for informational messages.
      See Also:
    • LEVEL_WARN

      public static final int LEVEL_WARN
      Typecode for warning messages.
      See Also:
    • LEVEL_ERROR

      public static final int LEVEL_ERROR
      Typecode for error messages.
      See Also:
    • LEVEL_FATAL

      public static final int LEVEL_FATAL
      Typecode for fatal error messages.
      See Also:
    • LEVEL_DISABLED

      public static final int LEVEL_DISABLED
      Typecode for disabled log levels.
      See Also:
  • Constructor Details

    • ConsoleLogger

      public ConsoleLogger()
      Creates a new ConsoleLogger with the priority set to DEBUG.
    • ConsoleLogger

      public ConsoleLogger(int logLevel)
      Creates a new ConsoleLogger.
      Parameters:
      logLevel - log level typecode
  • Method Details

    • debug

      public void debug(String message)
      Logs a debugging message.
      Specified by:
      debug in interface Logger
      Parameters:
      message - a String value
    • debug

      public void debug(String message, Throwable throwable)
      Logs a debugging message and an exception.
      Specified by:
      debug in interface Logger
      Parameters:
      message - a String value
      throwable - a Throwable value
    • isDebugEnabled

      public boolean isDebugEnabled()
      Returns true if debug-level logging is enabled, false otherwise.
      Specified by:
      isDebugEnabled in interface Logger
      Returns:
      true if debug-level logging
    • info

      public void info(String message)
      Logs an informational message.
      Specified by:
      info in interface Logger
      Parameters:
      message - a String value
    • info

      public void info(String message, Throwable throwable)
      Logs an informational message and an exception.
      Specified by:
      info in interface Logger
      Parameters:
      message - a String value
      throwable - a Throwable value
    • isInfoEnabled

      public boolean isInfoEnabled()
      Returns true if info-level logging is enabled, false otherwise.
      Specified by:
      isInfoEnabled in interface Logger
      Returns:
      true if info-level logging is enabled
    • warn

      public void warn(String message)
      Logs a warning message.
      Specified by:
      warn in interface Logger
      Parameters:
      message - a String value
    • warn

      public void warn(String message, Throwable throwable)
      Logs a warning message and an exception.
      Specified by:
      warn in interface Logger
      Parameters:
      message - a String value
      throwable - a Throwable value
    • isWarnEnabled

      public boolean isWarnEnabled()
      Returns true if warn-level logging is enabled, false otherwise.
      Specified by:
      isWarnEnabled in interface Logger
      Returns:
      true if warn-level logging is enabled
    • error

      public void error(String message)
      Logs an error message.
      Specified by:
      error in interface Logger
      Parameters:
      message - a String value
    • error

      public void error(String message, Throwable throwable)
      Logs an error message and an exception.
      Specified by:
      error in interface Logger
      Parameters:
      message - a String value
      throwable - a Throwable value
    • isErrorEnabled

      public boolean isErrorEnabled()
      Returns true if error-level logging is enabled, false otherwise.
      Specified by:
      isErrorEnabled in interface Logger
      Returns:
      true if error-level logging is enabled
    • fatalError

      public void fatalError(String message)
      Logs a fatal error message.
      Specified by:
      fatalError in interface Logger
      Parameters:
      message - a String value
    • fatalError

      public void fatalError(String message, Throwable throwable)
      Logs a fatal error message and an exception.
      Specified by:
      fatalError in interface Logger
      Parameters:
      message - a String value
      throwable - a Throwable value
    • isFatalErrorEnabled

      public boolean isFatalErrorEnabled()
      Returns true if fatal-level logging is enabled, false otherwise.
      Specified by:
      isFatalErrorEnabled in interface Logger
      Returns:
      true if fatal-level logging is enabled
    • getChildLogger

      public Logger getChildLogger(String name)
      Just returns this logger (ConsoleLogger is not hierarchical).
      Specified by:
      getChildLogger in interface Logger
      Parameters:
      name - ignored
      Returns:
      this logger