org.apache.commons.logging.impl

Class Log4JLogger

public class Log4JLogger extends Object implements Log, Serializable

Implementation of Log that maps directly to a Logger for log4J version 1.2.

Initial configuration of the corresponding Logger instances should be done in the usual manner, as outlined in the Log4J documentation.

The reason this logger is distinct from the 1.3 logger is that in version 1.2 of Log4J:

Log4J1.3 is expected to change Level so it no longer extends Priority, which is a non-binary-compatible change. The class generated by compiling this code against log4j 1.2 will therefore not run against log4j 1.3.
Constructor Summary
Log4JLogger()
Log4JLogger(String name)
Base constructor.
Log4JLogger(Logger logger)
For use with a log4j factory.
Method Summary
voiddebug(Object message)
Logs a message with org.apache.log4j.Priority.DEBUG.
voiddebug(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.DEBUG.
voiderror(Object message)
Logs a message with org.apache.log4j.Priority.ERROR.
voiderror(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.ERROR.
voidfatal(Object message)
Logs a message with org.apache.log4j.Priority.FATAL.
voidfatal(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.FATAL.
LoggergetLogger()
Return the native Logger instance we are using.
voidinfo(Object message)
Logs a message with org.apache.log4j.Priority.INFO.
voidinfo(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.INFO.
booleanisDebugEnabled()
Check whether the Log4j Logger used is enabled for DEBUG priority.
booleanisErrorEnabled()
Check whether the Log4j Logger used is enabled for ERROR priority.
booleanisFatalEnabled()
Check whether the Log4j Logger used is enabled for FATAL priority.
booleanisInfoEnabled()
Check whether the Log4j Logger used is enabled for INFO priority.
booleanisTraceEnabled()
Check whether the Log4j Logger used is enabled for TRACE priority.
booleanisWarnEnabled()
Check whether the Log4j Logger used is enabled for WARN priority.
voidtrace(Object message)
Logs a message with org.apache.log4j.Priority.TRACE.
voidtrace(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.TRACE.
voidwarn(Object message)
Logs a message with org.apache.log4j.Priority.WARN.
voidwarn(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.WARN.

Constructor Detail

Log4JLogger

public Log4JLogger()

Log4JLogger

public Log4JLogger(String name)
Base constructor.

Log4JLogger

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

Method Detail

debug

public void debug(Object message)
Logs a message with org.apache.log4j.Priority.DEBUG.

Parameters: message to log

See Also: debug

debug

public void debug(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.DEBUG.

Parameters: message to log t log this cause

See Also: Log

error

public void error(Object message)
Logs a message with org.apache.log4j.Priority.ERROR.

Parameters: message to log

See Also: error

error

public void error(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.ERROR.

Parameters: message to log t log this cause

See Also: Log

fatal

public void fatal(Object message)
Logs a message with org.apache.log4j.Priority.FATAL.

Parameters: message to log

See Also: fatal

fatal

public void fatal(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.FATAL.

Parameters: message to log t log this cause

See Also: Log

getLogger

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

info

public void info(Object message)
Logs a message with org.apache.log4j.Priority.INFO.

Parameters: message to log

See Also: info

info

public void info(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.INFO.

Parameters: message to log t log this cause

See Also: Log

isDebugEnabled

public boolean isDebugEnabled()
Check whether the Log4j Logger used is enabled for DEBUG priority.

isErrorEnabled

public boolean isErrorEnabled()
Check whether the Log4j Logger used is enabled for ERROR priority.

isFatalEnabled

public boolean isFatalEnabled()
Check whether the Log4j Logger used is enabled for FATAL priority.

isInfoEnabled

public boolean isInfoEnabled()
Check whether the Log4j Logger used is enabled for INFO priority.

isTraceEnabled

public boolean isTraceEnabled()
Check whether the Log4j Logger used is enabled for TRACE priority. When using a log4j version that does not support the TRACE level, this call will report whether DEBUG is enabled or not.

isWarnEnabled

public boolean isWarnEnabled()
Check whether the Log4j Logger used is enabled for WARN priority.

trace

public void trace(Object message)
Logs a message with org.apache.log4j.Priority.TRACE. When using a log4j version that does not support the TRACE level, the message will be logged at the DEBUG level.

Parameters: message to log

See Also: trace

trace

public void trace(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.TRACE. When using a log4j version that does not support the TRACE level, the message will be logged at the DEBUG level.

Parameters: message to log t log this cause

See Also: Log

warn

public void warn(Object message)
Logs a message with org.apache.log4j.Priority.WARN.

Parameters: message to log

See Also: warn

warn

public void warn(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.WARN.

Parameters: message to log t log this cause

See Also: Log