In case anyone's interested, I've written a Logger implementation for commons-logging. Maybe it makes sense adding it to the Avalong Framework logging package?
Bye. /lexi
package de.fzi.dbs.webmodels.logger;
import org.apache.avalon.framework.logger.Logger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
/**
* Avalon wrapper for commons logging loggers.
* @author [EMAIL PROTECTED]
*/
public class CommonsLogger implements Logger
{
/** Wrapped commons logger. */
protected Log log; /**
* Constructs a new wrapper for given commons logger.
* @param log commons logger to be wrapped.
*/
public CommonsLogger(final Log log)
{
this.log = log;
} /**
* Logs a debug message.
* @param message the message.
*/
public void debug(final String message)
{
log.debug(message);
} /**
* Logs a debug message.
* @param message message.
* @param throwable accompanying error event.
*/
public void debug(final String message, final Throwable throwable)
{
log.debug(message, throwable);
} /**
* Checks, if debug logging is on.
* @return <code>true</code> if debug logging is on, <code>false</code>
* otherwise.
*/
public boolean isDebugEnabled()
{
return log.isDebugEnabled();
} /**
* Logs an info message.
* @param message the message.
*/
public void info(final String message)
{
log.info(message);
} /**
* Logs an info message.
* @param message message.
* @param throwable accompanying error event.
*/
public void info(final String message, final Throwable throwable)
{
log.info(message, throwable);
} /**
* Checks, if info logging is on.
* @return <code>true</code> if info logging is on, <code>false</code>
* otherwise.
*/
public boolean isInfoEnabled()
{
return log.isInfoEnabled();
} /**
* Logs a warning message.
* @param message the message.
*/
public void warn(final String message)
{
log.warn(message);
} /**
* Logs a warning message.
* @param message message.
* @param throwable accompanying error event.
*/
public void warn(final String message, final Throwable throwable)
{
log.warn(message, throwable);
} public boolean isWarnEnabled()
{
return log.isWarnEnabled();
} /**
* Logs an error message.
* @param message the message.
*/
public void error(final String message)
{
log.error(message);
} /**
* Logs a. error message.
* @param message message.
* @param throwable accompanying error event.
*/
public void error(final String message, final Throwable throwable)
{
log.error(message, throwable);
} /**
* Checks, if error logging is on.
* @return <code>true</code> if error logging is on, <code>false</code>
* otherwise.
*/
public boolean isErrorEnabled()
{
return log.isErrorEnabled();
} /**
* Logs a fatal error message.
* @param message the message.
*/
public void fatalError(final String message)
{
log.fatal(message);
} /**
* Logs a fatal error message.
* @param message message.
* @param throwable accompanying error event.
*/
public void fatalError(final String message, final Throwable throwable)
{
log.fatal(message, throwable);
} /**
* Checks, if fatal error logging is on.
* @return <code>true</code> if fatal error logging is on, <code>false</code>
* otherwise.
*/
public boolean isFatalErrorEnabled()
{
return log.isFatalEnabled();
} /**
* Returns a child logger for the given name
* @param name child logger name.
* @return Child logger for the given name.
*/
public Logger getChildLogger(final String name)
{
return new CommonsLogger(
LogFactory.getLog(log.getClass().getName() + "." + name));
}
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
