org.apache.commons.logging.impl

Class Log4JLogger

Implemented Interfaces:
Log, Serializable

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

Implementation of Log that maps directly to a Log4J Logger. Initial configuration of the corresponding Logger instances should be done in the usual manner, as outlined in the Log4J documentation.
Version:
$Id: Log4JLogger.java,v 1.11 2004/05/19 21:01:23 rdonkin Exp $
Authors:
Scott Sanders
Rod Waldhoff
Robert Burrell Donkin

Field Summary

private static String
FQCN
The fully qualified name of the Log4JLogger class.
private static boolean
is12
private Logger
logger
Log to this logger
private String
name
Logger name

Constructor Summary

Log4JLogger()
Log4JLogger(Logger logger)
For use with a log4j factory.
Log4JLogger(String name)
Base constructor.

Method Summary

void
debug(Object message)
Log a message to the Log4j Logger with DEBUG priority.
void
debug(Object message, Throwable t)
Log an error to the Log4j Logger with DEBUG priority.
void
error(Object message)
Log a message to the Log4j Logger with ERROR priority.
void
error(Object message, Throwable t)
Log an error to the Log4j Logger with ERROR priority.
void
fatal(Object message)
Log a message to the Log4j Logger with FATAL priority.
void
fatal(Object message, Throwable t)
Log an error to the Log4j Logger with FATAL priority.
Logger
getLogger()
Return the native Logger instance we are using.
void
info(Object message)
Log a message to the Log4j Logger with INFO priority.
void
info(Object message, Throwable t)
Log an error to the Log4j Logger with INFO priority.
boolean
isDebugEnabled()
Check whether the Log4j Logger used is enabled for DEBUG priority.
boolean
isErrorEnabled()
Check whether the Log4j Logger used is enabled for ERROR priority.
boolean
isFatalEnabled()
Check whether the Log4j Logger used is enabled for FATAL priority.
boolean
isInfoEnabled()
Check whether the Log4j Logger used is enabled for INFO priority.
boolean
isTraceEnabled()
Check whether the Log4j Logger used is enabled for TRACE priority.
boolean
isWarnEnabled()
Check whether the Log4j Logger used is enabled for WARN priority.
void
trace(Object message)
Log a message to the Log4j Logger with TRACE priority.
void
trace(Object message, Throwable t)
Log an error to the Log4j Logger with TRACE priority.
void
warn(Object message)
Log a message to the Log4j Logger with WARN priority.
void
warn(Object message, Throwable t)
Log an error to the Log4j Logger with WARN priority.

Field Details

FQCN

private static final String FQCN
The fully qualified name of the Log4JLogger class.

is12

private static final boolean is12

logger

private Logger logger
Log to this logger

name

private String name
Logger name

Constructor Details

Log4JLogger

public Log4JLogger()

Log4JLogger

public Log4JLogger(Logger logger)
For use with a log4j factory.

Log4JLogger

public Log4JLogger(String name)
Base constructor.

Method Details

debug

public void debug(Object message)
Log a message to the Log4j Logger with DEBUG priority.
Specified by:
debug in interface Log

debug

public void debug(Object message,
                  Throwable t)
Log an error to the Log4j Logger with DEBUG priority.
Specified by:
debug in interface Log

error

public void error(Object message)
Log a message to the Log4j Logger with ERROR priority.
Specified by:
error in interface Log

error

public void error(Object message,
                  Throwable t)
Log an error to the Log4j Logger with ERROR priority.
Specified by:
error in interface Log

fatal

public void fatal(Object message)
Log a message to the Log4j Logger with FATAL priority.
Specified by:
fatal in interface Log

fatal

public void fatal(Object message,
                  Throwable t)
Log an error to the Log4j Logger with FATAL priority.
Specified by:
fatal in interface Log

getLogger

public Logger getLogger()
Return the native Logger instance we are using.

info

public void info(Object message)
Log a message to the Log4j Logger with INFO priority.
Specified by:
info in interface Log

info

public void info(Object message,
                 Throwable t)
Log an error to the Log4j Logger with INFO priority.
Specified by:
info in interface Log

isDebugEnabled

public boolean isDebugEnabled()
Check whether the Log4j Logger used is enabled for DEBUG priority.
Specified by:
isDebugEnabled in interface Log

isErrorEnabled

public boolean isErrorEnabled()
Check whether the Log4j Logger used is enabled for ERROR priority.
Specified by:
isErrorEnabled in interface Log

isFatalEnabled

public boolean isFatalEnabled()
Check whether the Log4j Logger used is enabled for FATAL priority.
Specified by:
isFatalEnabled in interface Log

isInfoEnabled

public boolean isInfoEnabled()
Check whether the Log4j Logger used is enabled for INFO priority.
Specified by:
isInfoEnabled in interface Log

isTraceEnabled

public boolean isTraceEnabled()
Check whether the Log4j Logger used is enabled for TRACE priority. For Log4J, this returns the value of isDebugEnabled()
Specified by:
isTraceEnabled in interface Log

isWarnEnabled

public boolean isWarnEnabled()
Check whether the Log4j Logger used is enabled for WARN priority.
Specified by:
isWarnEnabled in interface Log

trace

public void trace(Object message)
Log a message to the Log4j Logger with TRACE priority. Currently logs to DEBUG level in Log4J.
Specified by:
trace in interface Log

trace

public void trace(Object message,
                  Throwable t)
Log an error to the Log4j Logger with TRACE priority. Currently logs to DEBUG level in Log4J.
Specified by:
trace in interface Log

warn

public void warn(Object message)
Log a message to the Log4j Logger with WARN priority.
Specified by:
warn in interface Log

warn

public void warn(Object message,
                 Throwable t)
Log an error to the Log4j Logger with WARN priority.
Specified by:
warn in interface Log

Copyright 2002-2004 The Apache Software Foundation.