public class

Log4JLogger

extends Object
implements Serializable Log
java.lang.Object
   ↳ org.apache.commons.logging.impl.Log4JLogger

Class Overview

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:

  • class Logger takes Priority parameters not Level parameters.
  • class Level extends Priority
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.

Summary

Public Constructors
Log4JLogger()
Log4JLogger(String name)
Base constructor.
Log4JLogger(Logger logger)
For use with a log4j factory.
Public Methods
void debug(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.DEBUG.
void debug(Object message)
Logs a message with org.apache.log4j.Priority.DEBUG.
void error(Object message)
Logs a message with org.apache.log4j.Priority.ERROR.
void error(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.ERROR.
void fatal(Object message)
Logs a message with org.apache.log4j.Priority.FATAL.
void fatal(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.FATAL.
Logger getLogger()
Return the native Logger instance we are using.
void info(Object message)
Logs a message with org.apache.log4j.Priority.INFO.
void info(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.INFO.
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)
Logs a message with org.apache.log4j.Priority.TRACE.
void trace(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.TRACE.
void warn(Object message, Throwable t)
Logs a message with org.apache.log4j.Priority.WARN.
void warn(Object message)
Logs a message with org.apache.log4j.Priority.WARN.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.commons.logging.Log

Public Constructors

public Log4JLogger ()

public Log4JLogger (String name)

Base constructor.

public Log4JLogger (Logger logger)

For use with a log4j factory.

Public Methods

public void debug (Object message, Throwable t)

Logs a message with org.apache.log4j.Priority.DEBUG.

Parameters
message to log
t log this cause

public void debug (Object message)

Logs a message with org.apache.log4j.Priority.DEBUG.

Parameters
message to log
See Also

public void error (Object message)

Logs a message with org.apache.log4j.Priority.ERROR.

Parameters
message to log
See Also

public void error (Object message, Throwable t)

Logs a message with org.apache.log4j.Priority.ERROR.

Parameters
message to log
t log this cause

public void fatal (Object message)

Logs a message with org.apache.log4j.Priority.FATAL.

Parameters
message to log
See Also

public void fatal (Object message, Throwable t)

Logs a message with org.apache.log4j.Priority.FATAL.

Parameters
message to log
t log this cause

public Logger getLogger ()

Return the native Logger instance we are using.

public void info (Object message)

Logs a message with org.apache.log4j.Priority.INFO.

Parameters
message to log
See Also

public void info (Object message, Throwable t)

Logs a message with org.apache.log4j.Priority.INFO.

Parameters
message to log
t log this cause

public boolean isDebugEnabled ()

Check whether the Log4j Logger used is enabled for DEBUG priority.

Returns
  • true if debug is enabled in the underlying logger.

public boolean isErrorEnabled ()

Check whether the Log4j Logger used is enabled for ERROR priority.

Returns
  • true if error is enabled in the underlying logger.

public boolean isFatalEnabled ()

Check whether the Log4j Logger used is enabled for FATAL priority.

Returns
  • true if fatal is enabled in the underlying logger.

public boolean isInfoEnabled ()

Check whether the Log4j Logger used is enabled for INFO priority.

Returns
  • true if info is enabled in the underlying logger.

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.

Returns
  • true if trace is enabled in the underlying logger.

public boolean isWarnEnabled ()

Check whether the Log4j Logger used is enabled for WARN priority.

Returns
  • true if warn is enabled in the underlying logger.

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

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

public void warn (Object message, Throwable t)

Logs a message with org.apache.log4j.Priority.WARN.

Parameters
message to log
t log this cause

public void warn (Object message)

Logs a message with org.apache.log4j.Priority.WARN.

Parameters
message to log
See Also