org.apache.log4j

## Class Category

- java.lang.Object
- - 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.Category` class (as found in log4j 1.2) by delegation of all calls to a `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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Logger` | `slf4jLogger`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAppender(Appender newAppender)`
    `void` | `assertLog(boolean assertion, String msg)`
    `protected String` | `convertToString(Object message)`
    `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.
    `protected void` | `forcedLog(String FQCN, Priority p, Object msg, Throwable t)`
    `boolean` | `getAdditivity()`
    `Enumeration` | `getAllAppenders()`
    `Appender` | `getAppender(String name)`
    `Level` | `getEffectiveLevel()` Return the level in effect for this category/logger.
    `static Category` | `getInstance(Class clazz)`
    `static Category` | `getInstance(String name)`
    `Level` | `getLevel()` Returns the assigned `Level`, if any, for this Category.
    `String` | `getName()` Returns the obvious.
    `Category` | `getParent()`
    `Level` | `getPriority()` Deprecated. Please use `getLevel()` instead.
    `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(Priority p)` Determines whether the priority passed as parameter is enabled in the underlying SLF4J logger.
    `boolean` | `isErrorEnabled()` Delegates to `Logger.isErrorEnabled()` method in SLF4J
    `boolean` | `isInfoEnabled()` Delegates to `Logger.isInfoEnabled()` method in SLF4J
    `boolean` | `isWarnEnabled()` Delegates to `Logger.isWarnEnabled()` method in SLF4J
    `void` | `log(Priority p, Object message)`
    `void` | `log(Priority p, Object message, Throwable t)`
    `void` | `log(String FQCN, Priority p, Object msg, Throwable t)`
    `void` | `setAdditivity(boolean additive)`
    `void` | `setLevel(Level level)`
    `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`

- - ### Field Detail

    - #### slf4jLogger

          protected Logger slf4jLogger

  - ### Method Detail

    - #### getInstance

          public static Category getInstance(Class clazz)

    - #### getInstance

          public static Category getInstance(String name)

    - #### getParent

          public final Category getParent()

    - #### getName

          public String getName()

      Returns the obvious.
      Returns:

    - #### getAppender

          public Appender getAppender(String name)

    - #### getAllAppenders

          public Enumeration getAllAppenders()

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

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

      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.

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

    - #### forcedLog

          protected void forcedLog(String FQCN,
                       Priority p,
                       Object msg,
                       Throwable t)

    - #### log

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

    - #### log

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

    - #### log

          public void log(Priority p,
                 Object message)

    - #### convertToString

          protected final String convertToString(Object message)

    - #### setAdditivity

          public void setAdditivity(boolean additive)

    - #### addAppender

          public void addAppender(Appender newAppender)

    - #### setLevel

          public void setLevel(Level level)

    - #### getAdditivity

          public boolean getAdditivity()

    - #### assertLog

          public void assertLog(boolean assertion,
                       String msg)

Copyright © 2005–2017 QOS.ch. All rights reserved.