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 370631 2006-01-19 20:50:46Z rdonkin $
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)
Logs a message with org.apache.log.Priority.DEBUG.
void
debug(Object message, Throwable t)
Logs a message with org.apache.log.Priority.DEBUG.
void
error(Object message)
Logs a message with org.apache.log.Priority.ERROR.
void
error(Object message, Throwable t)
Logs a message with org.apache.log.Priority.ERROR.
void
fatal(Object message)
Logs a message with org.apache.log.Priority.FATAL_ERROR.
void
fatal(Object message, Throwable t)
Logs a message with org.apache.log.Priority.FATAL_ERROR.
Logger
getLogger()
Return the underlying Logger we are using.
void
info(Object message)
Logs a message with org.apache.log.Priority.INFO.
void
info(Object message, Throwable t)
Logs a message with org.apache.log.Priority.INFO.
boolean
isDebugEnabled()
Checks whether the LogKit logger will log messages of priority DEBUG.
boolean
isErrorEnabled()
Checks whether the LogKit logger will log messages of priority ERROR.
boolean
isFatalEnabled()
Checks whether the LogKit logger will log messages of priority FATAL_ERROR.
boolean
isInfoEnabled()
Checks whether the LogKit logger will log messages of priority INFO.
boolean
isTraceEnabled()
Checks whether the LogKit logger will log messages of priority DEBUG.
boolean
isWarnEnabled()
Checks whether the LogKit logger will log messages of priority WARN.
void
trace(Object message)
Logs a message with org.apache.log.Priority.DEBUG.
void
trace(Object message, Throwable t)
Logs a message with org.apache.log.Priority.DEBUG.
void
warn(Object message)
Logs a message with org.apache.log.Priority.WARN.
void
warn(Object message, Throwable t)
Logs a message with org.apache.log.Priority.WARN.

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)
Logs a message with org.apache.log.Priority.DEBUG.
Specified by:
debug in interface Log
Parameters:
message - to log

debug

public void debug(Object message,
                  Throwable t)
Logs a message with org.apache.log.Priority.DEBUG.
Specified by:
debug in interface Log
Parameters:
message - to log
t - log this cause

error

public void error(Object message)
Logs a message with org.apache.log.Priority.ERROR.
Specified by:
error in interface Log
Parameters:
message - to log

error

public void error(Object message,
                  Throwable t)
Logs a message with org.apache.log.Priority.ERROR.
Specified by:
error in interface Log
Parameters:
message - to log
t - log this cause

fatal

public void fatal(Object message)
Logs a message with org.apache.log.Priority.FATAL_ERROR.
Specified by:
fatal in interface Log
Parameters:
message - to log

fatal

public void fatal(Object message,
                  Throwable t)
Logs a message with org.apache.log.Priority.FATAL_ERROR.
Specified by:
fatal in interface Log
Parameters:
message - to log
t - log this cause

getLogger

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

info

public void info(Object message)
Logs a message with org.apache.log.Priority.INFO.
Specified by:
info in interface Log
Parameters:
message - to log

info

public void info(Object message,
                 Throwable t)
Logs a message with org.apache.log.Priority.INFO.
Specified by:
info in interface Log
Parameters:
message - to log
t - log this cause

isDebugEnabled

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

isErrorEnabled

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

isFatalEnabled

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

isInfoEnabled

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

isTraceEnabled

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

isWarnEnabled

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

trace

public void trace(Object message)
Logs a message with org.apache.log.Priority.DEBUG.
Specified by:
trace in interface Log
Parameters:
message - to log

trace

public void trace(Object message,
                  Throwable t)
Logs a message with org.apache.log.Priority.DEBUG.
Specified by:
trace in interface Log
Parameters:
message - to log
t - log this cause

warn

public void warn(Object message)
Logs a message with org.apache.log.Priority.WARN.
Specified by:
warn in interface Log
Parameters:
message - to log

warn

public void warn(Object message,
                 Throwable t)
Logs a message with org.apache.log.Priority.WARN.
Specified by:
warn in interface Log
Parameters:
message - to log
t - log this cause

Copyright 2002-2004 The Apache Software Foundation.