org.apache.log4j
Class Category

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

public class Category
extends Object

Implementation of the Category class for compatibility, despite it having been deprecated a long, long time ago.


Field Summary
protected  ResourceBundle bundle
          Resource bundle for localized messages.
 
Constructor Summary
protected Category(org.apache.logging.log4j.core.LoggerContext context, String name)
          Constructor used by Logger to specify a LoggerContext.
protected Category(String name)
          Constructor exposed by Log4j 1.2.
 
Method Summary
 void addAppender(Appender appender)
          No-op implementation.
 void assertLog(boolean assertion, String msg)
          If assertion parameter is false, then logs msg as an error statement.
 void callAppenders(LoggingEvent event)
          No-op implementation.
 void debug(Object message)
           
 void debug(Object message, Throwable t)
           
 void error(Object message)
           
 void error(Object message, Throwable t)
           
 boolean exists(String name)
           
 void fatal(Object message)
           
 void fatal(Object message, Throwable t)
           
 void forcedLog(String fqcn, Priority level, Object message, Throwable t)
           
 boolean getAdditivity()
           
 Enumeration getAllAppenders()
           
 Appender getAppender(String name)
          No-op implementation.
 Priority getChainedPriority()
           
static Enumeration getCurrentCategories()
          Deprecated. Please use LogManager.getCurrentLoggers() instead.
 Level getEffectiveLevel()
           
static Category getInstance(Class clazz)
           
static Category getInstance(String name)
           
 Level getLevel()
           
 String getName()
           
 Category getParent()
           
 Level getPriority()
           
 ResourceBundle getResourceBundle()
           
static Category getRoot()
           
 void info(Object message)
           
 void info(Object message, Throwable t)
           
 boolean isAttached(Appender appender)
          Is the appender passed as parameter attached to this category?
 boolean isDebugEnabled()
           
 boolean isEnabledFor(Priority level)
           
 boolean isErrorEnabled()
           
 boolean isFatalEnabled()
           
 boolean isInfoEnabled()
           
 boolean isTraceEnabled()
           
 boolean isWarnEnabled()
           
 void l7dlog(Priority priority, String key, Object[] params, Throwable t)
           
 void l7dlog(Priority priority, String key, Throwable t)
           
 void log(Priority priority, Object message)
           
 void log(Priority priority, Object message, Throwable t)
           
 void log(String fqcn, Priority priority, Object message, Throwable t)
           
 void removeAllAppenders()
          No-op implementation.
 void removeAppender(Appender appender)
          No-op implementation.
 void removeAppender(String name)
          No-op implementation.
 void setAdditivity(boolean additivity)
           
 void setLevel(Level level)
           
 void setPriority(Priority priority)
           
 void setResourceBundle(ResourceBundle bundle)
           
static void shutdown()
          No-op implementation.
 void trace(Object message)
           
 void trace(Object message, Throwable t)
           
 void warn(Object message)
           
 void warn(Object message, Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bundle

protected ResourceBundle bundle
Resource bundle for localized messages.

Constructor Detail

Category

protected Category(org.apache.logging.log4j.core.LoggerContext context,
                   String name)
Constructor used by Logger to specify a LoggerContext.

Parameters:
context - The LoggerContext.
name - The name of the Logger.

Category

protected Category(String name)
Constructor exposed by Log4j 1.2.

Parameters:
name - The name of the Logger.
Method Detail

getInstance

public static Category getInstance(String name)

getInstance

public static Category getInstance(Class clazz)

getName

public final String getName()

getParent

public final Category getParent()

getRoot

public static Category getRoot()

getCurrentCategories

@Deprecated
public static Enumeration getCurrentCategories()
Deprecated. Please use LogManager.getCurrentLoggers() instead.

Returns all the currently defined categories in the default hierarchy as an Enumeration.

The root category is not included in the returned Enumeration.

Returns:
and Enumeration of the Categories.

getEffectiveLevel

public final Level getEffectiveLevel()

getChainedPriority

public final Priority getChainedPriority()

getLevel

public final Level getLevel()

setLevel

public void setLevel(Level level)

getPriority

public final Level getPriority()

setPriority

public void setPriority(Priority priority)

debug

public void debug(Object message)

debug

public void debug(Object message,
                  Throwable t)

isDebugEnabled

public boolean isDebugEnabled()

error

public void error(Object message)

error

public void error(Object message,
                  Throwable t)

isErrorEnabled

public boolean isErrorEnabled()

warn

public void warn(Object message)

warn

public void warn(Object message,
                 Throwable t)

isWarnEnabled

public boolean isWarnEnabled()

fatal

public void fatal(Object message)

fatal

public void fatal(Object message,
                  Throwable t)

isFatalEnabled

public boolean isFatalEnabled()

info

public void info(Object message)

info

public void info(Object message,
                 Throwable t)

isInfoEnabled

public boolean isInfoEnabled()

trace

public void trace(Object message)

trace

public void trace(Object message,
                  Throwable t)

isTraceEnabled

public boolean isTraceEnabled()

isEnabledFor

public boolean isEnabledFor(Priority level)

addAppender

public void addAppender(Appender appender)
No-op implementation.

Parameters:
appender - The Appender to add.

callAppenders

public void callAppenders(LoggingEvent event)
No-op implementation.

Parameters:
event - The logging event.

getAllAppenders

public Enumeration getAllAppenders()

getAppender

public Appender getAppender(String name)
No-op implementation.

Parameters:
name - The name of the Appender.
Returns:
null.

isAttached

public boolean isAttached(Appender appender)
Is the appender passed as parameter attached to this category?

Parameters:
appender - The Appender to add.
Returns:
true if the appender is attached.

removeAllAppenders

public void removeAllAppenders()
No-op implementation.


removeAppender

public void removeAppender(Appender appender)
No-op implementation.

Parameters:
appender - The Appender to remove.

removeAppender

public void removeAppender(String name)
No-op implementation.

Parameters:
name - The Appender to remove.

shutdown

public static void shutdown()
No-op implementation.


forcedLog

public void forcedLog(String fqcn,
                      Priority level,
                      Object message,
                      Throwable t)

exists

public boolean exists(String name)

getAdditivity

public boolean getAdditivity()

setAdditivity

public void setAdditivity(boolean additivity)

setResourceBundle

public void setResourceBundle(ResourceBundle bundle)

getResourceBundle

public ResourceBundle getResourceBundle()

assertLog

public void assertLog(boolean assertion,
                      String msg)
If assertion parameter is false, then logs msg as an error statement.

The assert method has been renamed to assertLog because assert is a language reserved word in JDK 1.4.

Parameters:
assertion - The assertion.
msg - The message to print if assertion is false.
Since:
1.2

l7dlog

public void l7dlog(Priority priority,
                   String key,
                   Throwable t)

l7dlog

public void l7dlog(Priority priority,
                   String key,
                   Object[] params,
                   Throwable t)

log

public void log(Priority priority,
                Object message,
                Throwable t)

log

public void log(Priority priority,
                Object message)

log

public void log(String fqcn,
                Priority priority,
                Object message,
                Throwable t)


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.