Log4JLogger (Commons Logging 1.1.1 API)
Keywords: org.apache.commons.logging.impl.Log4JLogger class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.logging.impl
Class Log4JLogger

    java.lang.Object
      org.apache.commons.logging.impl.Log4JLogger

All Implemented Interfaces:
  Log, java.io.Serializable

public class Log4JLogger
extends java.lang.Object
implements Log, java.io.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:

- 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.

Version:
  $Id: Log4JLogger.java 479747 2006-11-27 20:15:01Z dennisl $
Author:
  Scott Sanders, Rod Waldhoff, Robert Burrell Donkin
See Also:
  Serialized Form

Constructor Summary
`Log4JLogger()`
`Log4JLogger(org.apache.log4j.Logger logger)` For use with a log4j factory.
`Log4JLogger(java.lang.String name)` Base constructor.

Method Summary
`void` | `debug(java.lang.Object message)` Logs a message with `org.apache.log4j.Priority.DEBUG`.
`void` | `debug(java.lang.Object message, java.lang.Throwable t)` Logs a message with `org.apache.log4j.Priority.DEBUG`.
`void` | `error(java.lang.Object message)` Logs a message with `org.apache.log4j.Priority.ERROR`.
`void` | `error(java.lang.Object message, java.lang.Throwable t)` Logs a message with `org.apache.log4j.Priority.ERROR`.
`void` | `fatal(java.lang.Object message)` Logs a message with `org.apache.log4j.Priority.FATAL`.
`void` | `fatal(java.lang.Object message, java.lang.Throwable t)` Logs a message with `org.apache.log4j.Priority.FATAL`.
`org.apache.log4j.Logger` | `getLogger()` Return the native Logger instance we are using.
`void` | `info(java.lang.Object message)` Logs a message with `org.apache.log4j.Priority.INFO`.
`void` | `info(java.lang.Object message, java.lang.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(java.lang.Object message)` Logs a message with `org.apache.log4j.Priority.TRACE`.
`void` | `trace(java.lang.Object message, java.lang.Throwable t)` Logs a message with `org.apache.log4j.Priority.TRACE`.
`void` | `warn(java.lang.Object message)` Logs a message with `org.apache.log4j.Priority.WARN`.
`void` | `warn(java.lang.Object message, java.lang.Throwable t)` Logs a message with `org.apache.log4j.Priority.WARN`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Log4JLogger

    public Log4JLogger()

### Log4JLogger

    public Log4JLogger(java.lang.String name)

  Base constructor.

### Log4JLogger

    public Log4JLogger(org.apache.log4j.Logger logger)

  For use with a log4j factory.

Method Detail

### trace

    public void trace(java.lang.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.

  Specified by:
    `trace` in interface `Log`
  Parameters:
    `message` - to log
  See Also:
    `Log.trace(Object)`

### trace

    public void trace(java.lang.Object message,
                      java.lang.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.

  Specified by:
    `trace` in interface `Log`
  Parameters:
    `message` - to log
    `t` - log this cause
  See Also:
    `Log.trace(Object, Throwable)`

### debug

    public void debug(java.lang.Object message)

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

  Specified by:
    `debug` in interface `Log`
  Parameters:
    `message` - to log
  See Also:
    `Log.debug(Object)`

### debug

    public void debug(java.lang.Object message,
                      java.lang.Throwable t)

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

  Specified by:
    `debug` in interface `Log`
  Parameters:
    `message` - to log
    `t` - log this cause
  See Also:
    `Log.debug(Object, Throwable)`

### info

    public void info(java.lang.Object message)

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

  Specified by:
    `info` in interface `Log`
  Parameters:
    `message` - to log
  See Also:
    `Log.info(Object)`

### info

    public void info(java.lang.Object message,
                     java.lang.Throwable t)

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

  Specified by:
    `info` in interface `Log`
  Parameters:
    `message` - to log
    `t` - log this cause
  See Also:
    `Log.info(Object, Throwable)`

### warn

    public void warn(java.lang.Object message)

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

  Specified by:
    `warn` in interface `Log`
  Parameters:
    `message` - to log
  See Also:
    `Log.warn(Object)`

### warn

    public void warn(java.lang.Object message,
                     java.lang.Throwable t)

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

  Specified by:
    `warn` in interface `Log`
  Parameters:
    `message` - to log
    `t` - log this cause
  See Also:
    `Log.warn(Object, Throwable)`

### error

    public void error(java.lang.Object message)

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

  Specified by:
    `error` in interface `Log`
  Parameters:
    `message` - to log
  See Also:
    `Log.error(Object)`

### error

    public void error(java.lang.Object message,
                      java.lang.Throwable t)

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

  Specified by:
    `error` in interface `Log`
  Parameters:
    `message` - to log
    `t` - log this cause
  See Also:
    `Log.error(Object, Throwable)`

### fatal

    public void fatal(java.lang.Object message)

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

  Specified by:
    `fatal` in interface `Log`
  Parameters:
    `message` - to log
  See Also:
    `Log.fatal(Object)`

### fatal

    public void fatal(java.lang.Object message,
                      java.lang.Throwable t)

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

  Specified by:
    `fatal` in interface `Log`
  Parameters:
    `message` - to log
    `t` - log this cause
  See Also:
    `Log.fatal(Object, Throwable)`

### getLogger

    public org.apache.log4j.Logger getLogger()

  Return the native Logger instance we are using.

### isDebugEnabled

    public boolean isDebugEnabled()

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

  Specified by:
    `isDebugEnabled` in interface `Log`
  Returns:
    true if debug is enabled in the underlying logger.

### isErrorEnabled

    public boolean isErrorEnabled()

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

  Specified by:
    `isErrorEnabled` in interface `Log`
  Returns:
    true if error is enabled in the underlying logger.

### isFatalEnabled

    public boolean isFatalEnabled()

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

  Specified by:
    `isFatalEnabled` in interface `Log`
  Returns:
    true if fatal is enabled in the underlying logger.

### isInfoEnabled

    public boolean isInfoEnabled()

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

  Specified by:
    `isInfoEnabled` in interface `Log`
  Returns:
    true if info is enabled in the underlying logger.

### 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.

  Specified by:
    `isTraceEnabled` in interface `Log`
  Returns:
    true if trace is enabled in the underlying logger.

### isWarnEnabled

    public boolean isWarnEnabled()

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

  Specified by:
    `isWarnEnabled` in interface `Log`
  Returns:
    true if warn is enabled in the underlying logger.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 The Apache Software Foundation. All Rights Reserved.