org.apache.log4j

Class Category

public class Category extends Object

This class is a minimal implementation of the original org.apache.log4j.Category class (as found in log4j 1.2) 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ü

Field Summary
protected Loggerslf4jLogger
Method Summary
protected StringconvertToString(Object message)
voiddebug(Object message)
Delegates to debug method of SLF4J.
voiddebug(Object message, Throwable t)
Delegates to debug method in SLF4J.
voiderror(Object message)
Delegates to error method in SLF4J.
voiderror(Object message, Throwable t)
Delegates to error method in SLF4J.
voidfatal(Object message)
Delegates to error method in SLF4J.
voidfatal(Object message, Throwable t)
Delegates to error method in SLF4J.
LevelgetEffectiveLevel()
Return the level in effect for this category/logger.
static CategorygetInstance(Class clazz)
static CategorygetInstance(String name)
LevelgetLevel()
Returns the assigned Level, if any, for this Category.
StringgetName()
Returns the obvious.
LevelgetPriority()
voidinfo(Object message)
Delegates to info method in SLF4J.
voidinfo(Object message, Throwable t)
Delegates to info method in SLF4J.
booleanisDebugEnabled()
Delegates to Logger method in SLF4J
booleanisEnabledFor(Priority p)
Determines whether the priority passed as parameter is enabled in the underlying SLF4J logger.
booleanisErrorEnabled()
Delegates to Logger method in SLF4J
booleanisInfoEnabled()
Delegates to Logger method in SLF4J
booleanisWarnEnabled()
Delegates tob Logger method in SLF4J
voidlog(String FQCN, Priority p, Object msg, Throwable t)
voidwarn(Object message)
Delegates to warn method in SLF4J.
voidwarn(Object message, Throwable t)
Delegates to warn method in SLF4J.

Field Detail

slf4jLogger

protected Logger slf4jLogger

Method Detail

convertToString

protected final String convertToString(Object message)

debug

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

debug

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

error

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

error

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

fatal

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

fatal

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

getEffectiveLevel

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

The result is computed by simulation.

Returns:

getInstance

public static Category getInstance(Class clazz)

getInstance

public static Category getInstance(String name)

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.

getName

public String getName()
Returns the obvious.

Returns:

getPriority

public final Level getPriority()

Deprecated: Please use Category instead.

info

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

info

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

isDebugEnabled

public boolean isDebugEnabled()
Delegates to Logger method in SLF4J

isEnabledFor

public boolean isEnabledFor(Priority p)
Determines whether the priority passed as parameter is enabled in the underlying SLF4J logger. Each log4j priority is mapped directly to its SLF4J equivalent, except for FATAL which is mapped as ERROR.

Parameters: p the priority to check against

Returns: true if this logger is enabled for the given level, false otherwise.

isErrorEnabled

public boolean isErrorEnabled()
Delegates to Logger method in SLF4J

isInfoEnabled

public boolean isInfoEnabled()
Delegates to Logger method in SLF4J

isWarnEnabled

public boolean isWarnEnabled()
Delegates tob Logger method in SLF4J

log

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

warn

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

warn

public void warn(Object message, Throwable t)
Delegates to warn method in SLF4J.
Copyright © 2005-2009 QOS.ch. All Rights Reserved.