org.apache.commons.logging.impl
Class Log4jProxy

java.lang.Object
  extended by org.apache.commons.logging.impl.Log4jProxy
All Implemented Interfaces:
java.io.Serializable, Log

public class Log4jProxy
extends java.lang.Object
implements Log, java.io.Serializable

A Log implementation that reflectively queries for the log4j Logger methods using the current thread context class loader.

Version:
$Revision: 1.3.6.3 $
Author:
Scott.Stark@jboss.org
See Also:
Serialized Form

Field Summary
private  java.lang.Object DEBUG
           
private  java.lang.Object ERROR
           
private  java.lang.Object FATAL
          The jboss custom Level for TRACE
private  java.lang.Object INFO
           
private  java.lang.reflect.Method isEnabledFor
          isEnabledFor(Priority level)
private  java.lang.reflect.Method log
          log(String callerFQCN, Priority level, Object message, Throwable t)
private  java.lang.Object logger
          The log4j Logger
private static java.lang.String PROXY_FQCN
          Use the Log4JLogger so that the %C format works correctly
private static long serialVersionUID
           
private  java.lang.Object TRACE
           
private  java.lang.Object WARN
           
 
Constructor Summary
Log4jProxy(java.lang.String name)
           
 
Method Summary
 void debug(java.lang.Object message)
           Log a message with debug log level.
 void debug(java.lang.Object message, java.lang.Throwable t)
           Log an error with debug log level.
static void displayClassInfo(java.lang.Class clazz, java.lang.StringBuffer results)
           
 void error(java.lang.Object message)
           Log a message with error log level.
 void error(java.lang.Object message, java.lang.Throwable t)
           Log an error with error log level.
 void fatal(java.lang.Object message)
           Log a message with fatal log level.
 void fatal(java.lang.Object message, java.lang.Throwable t)
           Log an error with fatal log level.
static java.net.URL[] getClassLoaderURLs(java.lang.ClassLoader cl)
          Use reflection to access a URL[] getURLs or URL[] getClasspath method so that non-URLClassLoader class loaders, or class loaders that override getURLs to return null or empty, can provide the true classpath info.
 void info(java.lang.Object message)
           Log a message with info log level.
 void info(java.lang.Object message, java.lang.Throwable t)
           Log an error with info log level.
 boolean isDebugEnabled()
           Is debug logging currently enabled?
private  boolean isEnabledFor(java.lang.Object level)
           
 boolean isErrorEnabled()
           Is error logging currently enabled?
 boolean isFatalEnabled()
           Is fatal logging currently enabled?
 boolean isInfoEnabled()
           Is info logging currently enabled?
 boolean isTraceEnabled()
           Is trace logging currently enabled?
 boolean isWarnEnabled()
           Is warn logging currently enabled?
private  void log(java.lang.Object level, java.lang.Object message, java.lang.Throwable t)
           
(package private) static java.lang.ClassLoader threadContextClassLoader()
           
 void trace(java.lang.Object message)
           Log a message with trace log level.
 void trace(java.lang.Object message, java.lang.Throwable t)
           Log an error with trace log level.
 void warn(java.lang.Object message)
           Log a message with warn log level.
 void warn(java.lang.Object message, java.lang.Throwable t)
           Log an error with warn log level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

PROXY_FQCN

private static final java.lang.String PROXY_FQCN
Use the Log4JLogger so that the %C format works correctly

See Also:
Constant Field Values

FATAL

private java.lang.Object FATAL
The jboss custom Level for TRACE


ERROR

private java.lang.Object ERROR

WARN

private java.lang.Object WARN

INFO

private java.lang.Object INFO

DEBUG

private java.lang.Object DEBUG

TRACE

private java.lang.Object TRACE

logger

private transient java.lang.Object logger
The log4j Logger


isEnabledFor

private java.lang.reflect.Method isEnabledFor
isEnabledFor(Priority level)


log

private java.lang.reflect.Method log
log(String callerFQCN, Priority level, Object message, Throwable t)

Constructor Detail

Log4jProxy

Log4jProxy(java.lang.String name)
Method Detail

threadContextClassLoader

static java.lang.ClassLoader threadContextClassLoader()

isDebugEnabled

public boolean isDebugEnabled()
Description copied from interface: Log

Is debug logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than debug.

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

isErrorEnabled

public boolean isErrorEnabled()
Description copied from interface: Log

Is error logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than error.

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

isFatalEnabled

public boolean isFatalEnabled()
Description copied from interface: Log

Is fatal logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than fatal.

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

isInfoEnabled

public boolean isInfoEnabled()
Description copied from interface: Log

Is info logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than info.

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

isTraceEnabled

public boolean isTraceEnabled()
Description copied from interface: Log

Is trace logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than trace.

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

isWarnEnabled

public boolean isWarnEnabled()
Description copied from interface: Log

Is warn logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than warn.

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

trace

public void trace(java.lang.Object message)
Description copied from interface: Log

Log a message with trace log level.

Specified by:
trace in interface Log
Parameters:
message - log this message

trace

public void trace(java.lang.Object message,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with trace log level.

Specified by:
trace in interface Log
Parameters:
message - log this message
t - log this cause

debug

public void debug(java.lang.Object message)
Description copied from interface: Log

Log a message with debug log level.

Specified by:
debug in interface Log
Parameters:
message - log this message

debug

public void debug(java.lang.Object message,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with debug log level.

Specified by:
debug in interface Log
Parameters:
message - log this message
t - log this cause

info

public void info(java.lang.Object message)
Description copied from interface: Log

Log a message with info log level.

Specified by:
info in interface Log
Parameters:
message - log this message

info

public void info(java.lang.Object message,
                 java.lang.Throwable t)
Description copied from interface: Log

Log an error with info log level.

Specified by:
info in interface Log
Parameters:
message - log this message
t - log this cause

warn

public void warn(java.lang.Object message)
Description copied from interface: Log

Log a message with warn log level.

Specified by:
warn in interface Log
Parameters:
message - log this message

warn

public void warn(java.lang.Object message,
                 java.lang.Throwable t)
Description copied from interface: Log

Log an error with warn log level.

Specified by:
warn in interface Log
Parameters:
message - log this message
t - log this cause

error

public void error(java.lang.Object message)
Description copied from interface: Log

Log a message with error log level.

Specified by:
error in interface Log
Parameters:
message - log this message

error

public void error(java.lang.Object message,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with error log level.

Specified by:
error in interface Log
Parameters:
message - log this message
t - log this cause

fatal

public void fatal(java.lang.Object message)
Description copied from interface: Log

Log a message with fatal log level.

Specified by:
fatal in interface Log
Parameters:
message - log this message

fatal

public void fatal(java.lang.Object message,
                  java.lang.Throwable t)
Description copied from interface: Log

Log an error with fatal log level.

Specified by:
fatal in interface Log
Parameters:
message - log this message
t - log this cause

log

private void log(java.lang.Object level,
                 java.lang.Object message,
                 java.lang.Throwable t)

isEnabledFor

private boolean isEnabledFor(java.lang.Object level)

displayClassInfo

public static void displayClassInfo(java.lang.Class clazz,
                                    java.lang.StringBuffer results)

getClassLoaderURLs

public static java.net.URL[] getClassLoaderURLs(java.lang.ClassLoader cl)
Use reflection to access a URL[] getURLs or URL[] getClasspath method so that non-URLClassLoader class loaders, or class loaders that override getURLs to return null or empty, can provide the true classpath info.



Copyright 2001-2005 The Apache Software Foundation.