org.apache.log4j
Class Category

java.lang.Object
  extended by org.apache.log4j.Category
Direct Known Subclasses:
Logger

public class Category
extends Object

This class is a minimal implementation of the original org.apache.log4j.Logger class by delegation of all calls to a org.slf4j.Logger.Logger instance.

Log4j's trace, debug(), info(), warn(), error() printing methods are directly mapped to their SLF4J equivalents. Log4j's fatal() printing method is mapped to SLF4J's error() method with a FATAL marker.

Author:
Sébastien Pennec, Ceki Gülcü

Method Summary
 void debug(Object message)
          Delegates to Logger.debug(String) method of SLF4J.
 void debug(Object message, Throwable t)
          Delegates to Logger.debug(String,Throwable) method in SLF4J.
 void error(Object message)
          Delegates to Logger.error(String) method in SLF4J.
 void error(Object message, Throwable t)
          Delegates to Logger.error(String,Throwable) method in SLF4J.
 void fatal(Object message)
          Delegates to Logger.error(String) method in SLF4J.
 void fatal(Object message, Throwable t)
          Delegates to Logger.error(String,Throwable) method in SLF4J.
 Level getEffectiveLevel()
          Return the level in effect for this category/logger.
 Level getLevel()
          Returns the assigned Level, if any, for this Category.
static Logger getLogger(Class clazz)
           
static Logger getLogger(String name)
           
 String getName()
          Returns the obvious.
 Level getPriority()
          Deprecated. Please use getLevel() instead.
static Logger getRootLogger()
          Does the obvious.
 void info(Object message)
          Delegates to Logger.info(String) method in SLF4J.
 void info(Object message, Throwable t)
          Delegates to Logger.info(String,Throwable) method in SLF4J.
 boolean isDebugEnabled()
          Delegates to Logger.isDebugEnabled() method in SLF4J
 boolean isEnabledFor(Level l)
          Determines whether the level passes as parameter is enabled in the underlying SLF4J logger.
 boolean isEnabledFor(Priority p)
          Delegates to isEnabledFor(Level).
 boolean isErrorEnabled()
          Delegates to Logger.isErrorEnabled() method in SLF4J
 boolean isInfoEnabled()
          Delegates to Logger.isInfoEnabled() method in SLF4J
 boolean isTraceEnabled()
          Delegates to Logger.isTraceEnabled() method of SLF4J.
 boolean isWarnEnabled()
          Delegates to Logger.isWarnEnabled() method in SLF4J
 void log(String FQCN, Priority p, Object msg, Throwable t)
           
 void trace(Object message)
          Delegates to Logger.trace(String) method in SLF4J.
 void trace(Object message, Throwable t)
          Delegates to Logger.trace(String,Throwable) method in SLF4J.
 void warn(Object message)
          Delegates to Logger.warn(String) method in SLF4J.
 void warn(Object message, Throwable t)
          Delegates to Logger.warn(String,Throwable) method in SLF4J.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLogger

public static Logger getLogger(String name)

getLogger

public static Logger getLogger(Class clazz)

getRootLogger

public static Logger getRootLogger()
Does the obvious.

Returns:

getName

public String getName()
Returns the obvious.

Returns:

getEffectiveLevel

public Level getEffectiveLevel()
Return the level in effect for this category/logger.

The result is computed by simulation.

Returns:

getLevel

public final Level getLevel()
Returns the assigned Level, if any, for this Category. This implementation always returns null.

Returns:
Level - the assigned Level, can be null.

getPriority

public final Level getPriority()
Deprecated. Please use getLevel() instead.


isTraceEnabled

public boolean isTraceEnabled()
Delegates to Logger.isTraceEnabled() method of SLF4J.


isDebugEnabled

public boolean isDebugEnabled()
Delegates to Logger.isDebugEnabled() method in SLF4J


isInfoEnabled

public boolean isInfoEnabled()
Delegates to Logger.isInfoEnabled() method in SLF4J


isWarnEnabled

public boolean isWarnEnabled()
Delegates to Logger.isWarnEnabled() method in SLF4J


isErrorEnabled

public boolean isErrorEnabled()
Delegates to Logger.isErrorEnabled() method in SLF4J


isEnabledFor

public boolean isEnabledFor(Priority p)
Delegates to isEnabledFor(Level).

Parameters:
p - the priority to check against
Returns:
true if this logger is enabled for the given priority, false otehrwise.

isEnabledFor

public boolean isEnabledFor(Level l)
Determines whether the level passes as parameter is enabled in the underlying SLF4J logger. Each log4j level is mapped directly to its SLF4J equivalent, except for FATAL which is mapped as ERROR.

Parameters:
l - the level to check against
Returns:
true if this logger is enabled for the given level, false otehrwise.

trace

public void trace(Object message)
Delegates to Logger.trace(String) method in SLF4J.


trace

public void trace(Object message,
                  Throwable t)
Delegates to Logger.trace(String,Throwable) method in SLF4J.


debug

public void debug(Object message)
Delegates to Logger.debug(String) method of SLF4J.


debug

public void debug(Object message,
                  Throwable t)
Delegates to Logger.debug(String,Throwable) method in SLF4J.


info

public void info(Object message)
Delegates to Logger.info(String) method in SLF4J.


info

public void info(Object message,
                 Throwable t)
Delegates to Logger.info(String,Throwable) method in SLF4J.


warn

public void warn(Object message)
Delegates to Logger.warn(String) method in SLF4J.


warn

public void warn(Object message,
                 Throwable t)
Delegates to Logger.warn(String,Throwable) method in SLF4J.


error

public void error(Object message)
Delegates to Logger.error(String) method in SLF4J.


error

public void error(Object message,
                  Throwable t)
Delegates to Logger.error(String,Throwable) method in SLF4J.


fatal

public void fatal(Object message)
Delegates to Logger.error(String) method in SLF4J.


fatal

public void fatal(Object message,
                  Throwable t)
Delegates to Logger.error(String,Throwable) method in SLF4J. In addition, the call is marked with a marker named "FATAL".


log

public void log(String FQCN,
                Priority p,
                Object msg,
                Throwable t)


Copyright © 2005-2008 QOS.ch. All Rights Reserved.