org.apache.commons.logging.impl

Class AvalonLogger

Implemented Interfaces:
Log, Serializable

public class AvalonLogger
extends java.lang.Object
implements Log, 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: 1.9 $ $Date: 2004/06/01 19:56:20 $
Author:
Neeme Praks

Field Summary

private static Logger
defaultLogger
Ancesteral avalon logger
private Logger
logger
Avalon logger used to perform log
private String
name
The name of this logger

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 setDefaultLogger(Logger).

Method Summary

void
debug(Object o)
void
debug(Object o, Throwable t)
void
error(Object o)
void
error(Object o, Throwable t)
void
fatal(Object o)
void
fatal(Object o, Throwable t)
Logger
getLogger()
Gets the Avalon logger implementation used to perform logging.
void
info(Object o)
void
info(Object o, Throwable t)
boolean
isDebugEnabled()
boolean
isErrorEnabled()
boolean
isFatalEnabled()
boolean
isInfoEnabled()
boolean
isTraceEnabled()
boolean
isWarnEnabled()
static void
setDefaultLogger(Logger logger)
Sets the ancesteral Avalon logger from which the delegating loggers will descend.
void
trace(Object o)
void
trace(Object o, Throwable t)
void
warn(Object o)
void
warn(Object o, Throwable t)

Field Details

defaultLogger

private static Logger defaultLogger
Ancesteral avalon logger

logger

private Logger logger
Avalon logger used to perform log

name

private String name
The name of this logger

Constructor Details

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)
Parameters:
name - the name of the avalon logger implementation to delegate to

Method Details

debug

public void debug(Object o)
Specified by:
debug in interface Log
See Also:
org.apache.commons.logging.Log.debug(java.lang.Object)

debug

public void debug(Object o,
                  Throwable t)
Specified by:
debug in interface Log
See Also:
org.apache.commons.logging.Log.debug(java.lang.Object, java.lang.Throwable)

error

public void error(Object o)
Specified by:
error in interface Log
See Also:
org.apache.commons.logging.Log.error(java.lang.Object)

error

public void error(Object o,
                  Throwable t)
Specified by:
error in interface Log
See Also:
org.apache.commons.logging.Log.error(java.lang.Object, java.lang.Throwable)

fatal

public void fatal(Object o)
Specified by:
fatal in interface Log
See Also:
org.apache.commons.logging.Log.fatal(java.lang.Object)

fatal

public void fatal(Object o,
                  Throwable t)
Specified by:
fatal in interface Log
See Also:
org.apache.commons.logging.Log.fatal(java.lang.Object, java.lang.Throwable)

getLogger

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

info

public void info(Object o)
Specified by:
info in interface Log
See Also:
org.apache.commons.logging.Log.info(java.lang.Object)

info

public void info(Object o,
                 Throwable t)
Specified by:
info in interface Log
See Also:
org.apache.commons.logging.Log.info(java.lang.Object, java.lang.Throwable)

isDebugEnabled

public boolean isDebugEnabled()
Specified by:
isDebugEnabled in interface Log

isErrorEnabled

public boolean isErrorEnabled()
Specified by:
isErrorEnabled in interface Log

isFatalEnabled

public boolean isFatalEnabled()
Specified by:
isFatalEnabled in interface Log

isInfoEnabled

public boolean isInfoEnabled()
Specified by:
isInfoEnabled in interface Log

isTraceEnabled

public boolean isTraceEnabled()
Specified by:
isTraceEnabled in interface Log

isWarnEnabled

public boolean isWarnEnabled()
Specified by:
isWarnEnabled in interface Log

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 o)
Specified by:
trace in interface Log
See Also:
org.apache.commons.logging.Log.trace(java.lang.Object)

trace

public void trace(Object o,
                  Throwable t)
Specified by:
trace in interface Log
See Also:
org.apache.commons.logging.Log.trace(java.lang.Object, java.lang.Throwable)

warn

public void warn(Object o)
Specified by:
warn in interface Log
See Also:
org.apache.commons.logging.Log.warn(java.lang.Object)

warn

public void warn(Object o,
                 Throwable t)
Specified by:
warn in interface Log
See Also:
org.apache.commons.logging.Log.warn(java.lang.Object, java.lang.Throwable)

Copyright 2002-2004 The Apache Software Foundation.