org.apache.commons.logging.impl

Class LogKitLogger

Implemented Interfaces:
Log, Serializable

public class LogKitLogger
extends java.lang.Object
implements Log, Serializable

Implementation of org.apache.commons.logging.Log that wraps the avalon-logkit logging system. Configuration of LogKit is left to the user.

LogKit accepts only String messages. Therefore, this implementation converts object messages into strings by called their toString() method before logging them.

Version:
$Id: LogKitLogger.java,v 1.9 2004/06/01 19:56:46 rdonkin Exp $
Authors:
Scott Sanders
Robert Burrell Donkin

Field Summary

protected Logger
logger
Logging goes to this LogKit logger
protected String
name
Name of this logger

Constructor Summary

LogKitLogger(String name)
Construct LogKitLogger which wraps the LogKit logger with given name.

Method Summary

void
debug(Object message)
Log message to LogKit logger with DEBUG priority.
void
debug(Object message, Throwable t)
Log error to LogKit logger with DEBUG priority.
void
error(Object message)
Log message to LogKit logger with ERROR priority.
void
error(Object message, Throwable t)
Log error to LogKit logger with ERROR priority.
void
fatal(Object message)
Log message to LogKit logger with FATAL_ERROR priority.
void
fatal(Object message, Throwable t)
Log error to LogKit logger with FATAL_ERROR priority.
Logger
getLogger()
Return the underlying Logger we are using.
void
info(Object message)
Log message to LogKit logger with INFO priority.
void
info(Object message, Throwable t)
Log error to LogKit logger with INFO priority.
boolean
isDebugEnabled()
Check whether the LogKit logger will log messages of priority DEBUG.
boolean
isErrorEnabled()
Check whether the LogKit logger will log messages of priority ERROR.
boolean
isFatalEnabled()
Check whether the LogKit logger will log messages of priority FATAL_ERROR.
boolean
isInfoEnabled()
Check whether the LogKit logger will log messages of priority INFO.
boolean
isTraceEnabled()
Check whether the LogKit logger will log messages of priority DEBUG.
boolean
isWarnEnabled()
Check whether the LogKit logger will log messages of priority WARN.
void
trace(Object message)
Log message to LogKit logger with DEBUG priority.
void
trace(Object message, Throwable t)
Log error to LogKit logger with DEBUG priority.
void
warn(Object message)
Log message to LogKit logger with WARN priority.
void
warn(Object message, Throwable t)
Log error to LogKit logger with WARN priority.

Field Details

logger

protected Logger logger
Logging goes to this LogKit logger

name

protected String name
Name of this logger

Constructor Details

LogKitLogger

public LogKitLogger(String name)
Construct LogKitLogger which wraps the LogKit logger with given name.
Parameters:
name - log name

Method Details

debug

public void debug(Object message)
Log message to LogKit logger with DEBUG priority.
Specified by:
debug in interface Log

debug

public void debug(Object message,
                  Throwable t)
Log error to LogKit logger with DEBUG priority.
Specified by:
debug in interface Log

error

public void error(Object message)
Log message to LogKit logger with ERROR priority.
Specified by:
error in interface Log

error

public void error(Object message,
                  Throwable t)
Log error to LogKit logger with ERROR priority.
Specified by:
error in interface Log

fatal

public void fatal(Object message)
Log message to LogKit logger with FATAL_ERROR priority.
Specified by:
fatal in interface Log

fatal

public void fatal(Object message,
                  Throwable t)
Log error to LogKit logger with FATAL_ERROR priority.
Specified by:
fatal in interface Log

getLogger

public Logger getLogger()
Return the underlying Logger we are using.

info

public void info(Object message)
Log message to LogKit logger with INFO priority.
Specified by:
info in interface Log

info

public void info(Object message,
                 Throwable t)
Log error to LogKit logger with INFO priority.
Specified by:
info in interface Log

isDebugEnabled

public boolean isDebugEnabled()
Check whether the LogKit logger will log messages of priority DEBUG.
Specified by:
isDebugEnabled in interface Log

isErrorEnabled

public boolean isErrorEnabled()
Check whether the LogKit logger will log messages of priority ERROR.
Specified by:
isErrorEnabled in interface Log

isFatalEnabled

public boolean isFatalEnabled()
Check whether the LogKit logger will log messages of priority FATAL_ERROR.
Specified by:
isFatalEnabled in interface Log

isInfoEnabled

public boolean isInfoEnabled()
Check whether the LogKit logger will log messages of priority INFO.
Specified by:
isInfoEnabled in interface Log

isTraceEnabled

public boolean isTraceEnabled()
Check whether the LogKit logger will log messages of priority DEBUG.
Specified by:
isTraceEnabled in interface Log

isWarnEnabled

public boolean isWarnEnabled()
Check whether the LogKit logger will log messages of priority WARN.
Specified by:
isWarnEnabled in interface Log

trace

public void trace(Object message)
Log message to LogKit logger with DEBUG priority.
Specified by:
trace in interface Log

trace

public void trace(Object message,
                  Throwable t)
Log error to LogKit logger with DEBUG priority.
Specified by:
trace in interface Log

warn

public void warn(Object message)
Log message to LogKit logger with WARN priority.
Specified by:
warn in interface Log

warn

public void warn(Object message,
                 Throwable t)
Log error to LogKit logger with WARN priority.
Specified by:
warn in interface Log

Copyright 2002-2004 The Apache Software Foundation.