org.apache.commons.logging.impl
Class AvalonLogger

java.lang.Object
  |
  +--org.apache.commons.logging.impl.AvalonLogger
All Implemented Interfaces:
Log, java.io.Serializable

public class AvalonLogger
extends java.lang.Object
implements Log, java.io.Serializable

Implementation of commons-logging Log interface that delegates all logging calls to the Avalon logging abstraction: the Logger interface.

There are two ways in which this class can be used:

Version:
$Revision: 853148 $ $Date: 2004/06/01 19:56:20 $
Author:
Neeme Praks
See Also:
Serialized Form

Constructor Summary
AvalonLogger(org.apache.avalon.framework.logger.Logger logger)
          Constructs an AvalonLogger that outputs to the given Logger instance.
AvalonLogger(java.lang.String name)
          Constructs an AvalonLogger that will log to a child of the Logger set by calling setDefaultLogger(org.apache.avalon.framework.logger.Logger).
 
Method Summary
 void debug(java.lang.Object o)
           Log a message with debug log level.
 void debug(java.lang.Object o, java.lang.Throwable t)
           Log an error with debug log level.
 void error(java.lang.Object o)
           Log a message with error log level.
 void error(java.lang.Object o, java.lang.Throwable t)
           Log an error with error log level.
 void fatal(java.lang.Object o)
           Log a message with fatal log level.
 void fatal(java.lang.Object o, java.lang.Throwable t)
           Log an error with fatal log level.
 org.apache.avalon.framework.logger.Logger getLogger()
          Gets the Avalon logger implementation used to perform logging.
 void info(java.lang.Object o)
           Log a message with info log level.
 void info(java.lang.Object o, java.lang.Throwable t)
           Log an error with info log level.
 boolean isDebugEnabled()
           Is debug logging currently enabled?
 boolean isErrorEnabled()
           Is error logging currently enabled?
 boolean isFatalEnabled()
           Is fatal logging currently enabled?
 boolean isInfoEnabled()
           Is info logging currently enabled?
 boolean isTraceEnabled()
           Is trace logging currently enabled?
 boolean isWarnEnabled()
           Is warn logging currently enabled?
static void setDefaultLogger(org.apache.avalon.framework.logger.Logger logger)
          Sets the ancesteral Avalon logger from which the delegating loggers will descend.
 void trace(java.lang.Object o)
           Log a message with trace log level.
 void trace(java.lang.Object o, java.lang.Throwable t)
           Log an error with trace log level.
 void warn(java.lang.Object o)
           Log a message with warn log level.
 void warn(java.lang.Object o, java.lang.Throwable t)
           Log an error with warn log level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvalonLogger

public AvalonLogger(org.apache.avalon.framework.logger.Logger logger)
Constructs an AvalonLogger that outputs to the given Logger instance.

Parameters:
logger - the avalon logger implementation to delegate to

AvalonLogger

public AvalonLogger(java.lang.String name)
Constructs an AvalonLogger that will log to a child of the Logger set by calling setDefaultLogger(org.apache.avalon.framework.logger.Logger).

Parameters:
name - the name of the avalon logger implementation to delegate to
Method Detail

getLogger

public org.apache.avalon.framework.logger.Logger getLogger()
Gets the Avalon logger implementation used to perform logging.

Returns:
avalon logger implementation

setDefaultLogger

public static void setDefaultLogger(org.apache.avalon.framework.logger.Logger logger)
Sets the ancesteral Avalon logger from which the delegating loggers will descend.

Parameters:
logger - the default avalon logger, in case there is no logger instance supplied in constructor

debug

public void debug(java.lang.Object o,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with debug log level.

Specified by:
debug in interface Log
Parameters:
o - log this message
t - log this cause
See Also:
Log.debug(java.lang.Object, java.lang.Throwable)

debug

public void debug(java.lang.Object o)
Description copied from interface: Log

Log a message with debug log level.

Specified by:
debug in interface Log
Parameters:
o - log this message
See Also:
Log.debug(java.lang.Object)

error

public void error(java.lang.Object o,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with error log level.

Specified by:
error in interface Log
Parameters:
o - log this message
t - log this cause
See Also:
Log.error(java.lang.Object, java.lang.Throwable)

error

public void error(java.lang.Object o)
Description copied from interface: Log

Log a message with error log level.

Specified by:
error in interface Log
Parameters:
o - log this message
See Also:
Log.error(java.lang.Object)

fatal

public void fatal(java.lang.Object o,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with fatal log level.

Specified by:
fatal in interface Log
Parameters:
o - log this message
t - log this cause
See Also:
Log.fatal(java.lang.Object, java.lang.Throwable)

fatal

public void fatal(java.lang.Object o)
Description copied from interface: Log

Log a message with fatal log level.

Specified by:
fatal in interface Log
Parameters:
o - log this message
See Also:
Log.fatal(java.lang.Object)

info

public void info(java.lang.Object o,
                 java.lang.Throwable t)
Description copied from interface: Log

Log an error with info log level.

Specified by:
info in interface Log
Parameters:
o - log this message
t - log this cause
See Also:
Log.info(java.lang.Object, java.lang.Throwable)

info

public void info(java.lang.Object o)
Description copied from interface: Log

Log a message with info log level.

Specified by:
info in interface Log
Parameters:
o - log this message
See Also:
Log.info(java.lang.Object)

isDebugEnabled

public boolean isDebugEnabled()
Description copied from interface: Log

Is debug logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than debug.

Specified by:
isDebugEnabled in interface Log
See Also:
Log.isDebugEnabled()

isErrorEnabled

public boolean isErrorEnabled()
Description copied from interface: Log

Is error logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than error.

Specified by:
isErrorEnabled in interface Log
See Also:
Log.isErrorEnabled()

isFatalEnabled

public boolean isFatalEnabled()
Description copied from interface: Log

Is fatal logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than fatal.

Specified by:
isFatalEnabled in interface Log
See Also:
Log.isFatalEnabled()

isInfoEnabled

public boolean isInfoEnabled()
Description copied from interface: Log

Is info logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than info.

Specified by:
isInfoEnabled in interface Log
See Also:
Log.isInfoEnabled()

isTraceEnabled

public boolean isTraceEnabled()
Description copied from interface: Log

Is trace logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than trace.

Specified by:
isTraceEnabled in interface Log
See Also:
Log.isTraceEnabled()

isWarnEnabled

public boolean isWarnEnabled()
Description copied from interface: Log

Is warn logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than warn.

Specified by:
isWarnEnabled in interface Log
See Also:
Log.isWarnEnabled()

trace

public void trace(java.lang.Object o,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with trace log level.

Specified by:
trace in interface Log
Parameters:
o - log this message
t - log this cause
See Also:
Log.trace(java.lang.Object, java.lang.Throwable)

trace

public void trace(java.lang.Object o)
Description copied from interface: Log

Log a message with trace log level.

Specified by:
trace in interface Log
Parameters:
o - log this message
See Also:
Log.trace(java.lang.Object)

warn

public void warn(java.lang.Object o,
                 java.lang.Throwable t)
Description copied from interface: Log

Log an error with warn log level.

Specified by:
warn in interface Log
Parameters:
o - log this message
t - log this cause
See Also:
Log.warn(java.lang.Object, java.lang.Throwable)

warn

public void warn(java.lang.Object o)
Description copied from interface: Log

Log a message with warn log level.

Specified by:
warn in interface Log
Parameters:
o - log this message
See Also:
Log.warn(java.lang.Object)


Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.