org.apache.avalon.framework.logger

Class ConsoleLogger

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: $Id: ConsoleLogger.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $

Author: Avalon Development Team

Field Summary
static intLEVEL_DEBUG
Typecode for debugging messages.
static intLEVEL_DISABLED
Typecode for disabled log levels.
static intLEVEL_ERROR
Typecode for error messages.
static intLEVEL_FATAL
Typecode for fatal error messages.
static intLEVEL_INFO
Typecode for informational messages.
static intLEVEL_WARN
Typecode for warning messages.
intm_logLevel
Constructor Summary
ConsoleLogger()
Creates a new ConsoleLogger with the priority set to DEBUG.
ConsoleLogger(int logLevel)
Creates a new ConsoleLogger.
Method Summary
voiddebug(String message)
Logs a debugging message.
voiddebug(String message, Throwable throwable)
Logs a debugging message and an exception.
voiderror(String message)
Logs an error message.
voiderror(String message, Throwable throwable)
Logs an error message and an exception.
voidfatalError(String message)
Logs a fatal error message.
voidfatalError(String message, Throwable throwable)
Logs a fatal error message and an exception.
LoggergetChildLogger(String name)
Just returns this logger (ConsoleLogger is not hierarchical).
voidinfo(String message)
Logs an informational message.
voidinfo(String message, Throwable throwable)
Logs an informational message and an exception.
booleanisDebugEnabled()
Returns true if debug-level logging is enabled, false otherwise.
booleanisErrorEnabled()
Returns true if error-level logging is enabled, false otherwise.
booleanisFatalErrorEnabled()
Returns true if fatal-level logging is enabled, false otherwise.
booleanisInfoEnabled()
Returns true if info-level logging is enabled, false otherwise.
booleanisWarnEnabled()
Returns true if warn-level logging is enabled, false otherwise.
voidwarn(String message)
Logs a warning message.
voidwarn(String message, Throwable throwable)
Logs a warning message and an exception.

Field Detail

LEVEL_DEBUG

public static final int LEVEL_DEBUG
Typecode for debugging messages.

LEVEL_DISABLED

public static final int LEVEL_DISABLED
Typecode for disabled log levels.

LEVEL_ERROR

public static final int LEVEL_ERROR
Typecode for error messages.

LEVEL_FATAL

public static final int LEVEL_FATAL
Typecode for fatal error messages.

LEVEL_INFO

public static final int LEVEL_INFO
Typecode for informational messages.

LEVEL_WARN

public static final int LEVEL_WARN
Typecode for warning messages.

m_logLevel

private final int m_logLevel

Constructor Detail

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 Detail

debug

public void debug(String message)
Logs a debugging message.

Parameters: message a String value

debug

public void debug(String message, Throwable throwable)
Logs a debugging message and an exception.

Parameters: message a String value throwable a Throwable value

error

public void error(String message)
Logs an error message.

Parameters: message a String value

error

public void error(String message, Throwable throwable)
Logs an error message and an exception.

Parameters: message a String value throwable a Throwable value

fatalError

public void fatalError(String message)
Logs a fatal error message.

Parameters: message a String value

fatalError

public void fatalError(String message, Throwable throwable)
Logs a fatal error message and an exception.

Parameters: message a String value throwable a Throwable value

getChildLogger

public Logger getChildLogger(String name)
Just returns this logger (ConsoleLogger is not hierarchical).

Parameters: name ignored

Returns: this logger

info

public void info(String message)
Logs an informational message.

Parameters: message a String value

info

public void info(String message, Throwable throwable)
Logs an informational message and an exception.

Parameters: message a String value throwable a Throwable value

isDebugEnabled

public boolean isDebugEnabled()
Returns true if debug-level logging is enabled, false otherwise.

Returns: true if debug-level logging

isErrorEnabled

public boolean isErrorEnabled()
Returns true if error-level logging is enabled, false otherwise.

Returns: true if error-level logging is enabled

isFatalErrorEnabled

public boolean isFatalErrorEnabled()
Returns true if fatal-level logging is enabled, false otherwise.

Returns: true if fatal-level logging is enabled

isInfoEnabled

public boolean isInfoEnabled()
Returns true if info-level logging is enabled, false otherwise.

Returns: true if info-level logging is enabled

isWarnEnabled

public boolean isWarnEnabled()
Returns true if warn-level logging is enabled, false otherwise.

Returns: true if warn-level logging is enabled

warn

public void warn(String message)
Logs a warning message.

Parameters: message a String value

warn

public void warn(String message, Throwable throwable)
Logs a warning message and an exception.

Parameters: message a String value throwable a Throwable value