org.apache.commons.logging.impl

Class AvalonLogger

public class AvalonLogger extends Object implements Log

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:

Note: AvalonLogger does not implement Serializable because the constructors available for it make this impossible to achieve in all circumstances; there is no way to "reconnect" to an underlying Logger object on deserialization if one was just passed in to the constructor of the original object. This class was marked Serializable in the 1.0.4 release of commons-logging, but this never actually worked (a NullPointerException would be thrown as soon as the deserialized object was used), so removing this marker is not considered to be an incompatible change.

Constructor Summary
AvalonLogger(Logger logger)
Constructs an AvalonLogger that outputs to the given Logger instance.
AvalonLogger(String name)
Constructs an AvalonLogger that will log to a child of the Logger set by calling AvalonLogger.
Method Summary
voiddebug(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
voiddebug(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
voiderror(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.error.
voiderror(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.error.
voidfatal(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.
voidfatal(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.
LoggergetLogger()
Gets the Avalon logger implementation used to perform logging.
voidinfo(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.info.
voidinfo(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.info.
booleanisDebugEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?
booleanisErrorEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.error enabled?
booleanisFatalEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.fatalError enabled?
booleanisInfoEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.info enabled?
booleanisTraceEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?
booleanisWarnEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.warn enabled?
static voidsetDefaultLogger(Logger logger)
Sets the ancesteral Avalon logger from which the delegating loggers will descend.
voidtrace(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
voidtrace(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
voidwarn(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.warn.
voidwarn(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.warn.

Constructor Detail

AvalonLogger

public AvalonLogger(Logger logger)
Constructs an AvalonLogger that outputs to the given Logger instance.

Parameters: logger the avalon logger implementation to delegate to

AvalonLogger

public AvalonLogger(String name)
Constructs an AvalonLogger that will log to a child of the Logger set by calling AvalonLogger.

Parameters: name the name of the avalon logger implementation to delegate to

Method Detail

debug

public void debug(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters: message to log t log this cause

See Also: Log

debug

public void debug(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters: message to log.

See Also: debug

error

public void error(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.error.

Parameters: message to log t log this cause

See Also: Log

error

public void error(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.error.

Parameters: message to log

See Also: error

fatal

public void fatal(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.

Parameters: message to log. t log this cause.

See Also: Log

fatal

public void fatal(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.

Parameters: message to log

See Also: fatal

getLogger

public Logger getLogger()
Gets the Avalon logger implementation used to perform logging.

Returns: avalon logger implementation

info

public void info(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.info.

Parameters: message to log t log this cause

See Also: Log

info

public void info(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.info.

Parameters: message to log

See Also: info

isDebugEnabled

public boolean isDebugEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?

See Also: isDebugEnabled

isErrorEnabled

public boolean isErrorEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.error enabled?

See Also: isErrorEnabled

isFatalEnabled

public boolean isFatalEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.fatalError enabled?

See Also: isFatalEnabled

isInfoEnabled

public boolean isInfoEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.info enabled?

See Also: isInfoEnabled

isTraceEnabled

public boolean isTraceEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?

See Also: isTraceEnabled

isWarnEnabled

public boolean isWarnEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.warn enabled?

See Also: isWarnEnabled

setDefaultLogger

public static void setDefaultLogger(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

trace

public void trace(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters: message to log. t log this cause.

See Also: Log

trace

public void trace(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters: message to log

See Also: trace

warn

public void warn(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.warn.

Parameters: message to log t log this cause

See Also: Log

warn

public void warn(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.warn.

Parameters: message to log

See Also: warn