org.apache.xmlbeans.impl.common

## Class XBLogger

- java.lang.Object
- - org.apache.xmlbeans.impl.common.XBLogger

- Direct Known Subclasses:
    NullLogger

      public abstract class XBLogger
      extends Object

  A logger interface that strives to make it as easy as possible for developers to write log calls, while simultaneously making those calls as cheap as possible by performing lazy evaluation of the log message.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEBUG`
    `static int` | `ERROR`
    `static int` | `FATAL`
    `static int` | `INFO`
    `protected static String[]` | `LEVEL_STRINGS` Long strings for numeric log level.
    `protected static String[]` | `LEVEL_STRINGS_SHORT` Short strings for numeric log level.
    `static int` | `WARN`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `_log(int level, Object obj1)` Log a message
    `protected abstract void` | `_log(int level, Object obj1, Throwable exception)` Log a message
    `abstract boolean` | `check(int level)` Check if a logger is enabled to log at the specified level This allows code to avoid building strings or evaluating functions in the arguments to log.
    `abstract void` | `initialize(String cat)`
    `void` | `log(int level, Object... objs)` Log a message.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEBUG

          public static final int DEBUG

      See Also:
        Constant Field Values

    - #### INFO

          public static final int INFO

      See Also:
        Constant Field Values

    - #### WARN

          public static final int WARN

      See Also:
        Constant Field Values

    - #### ERROR

          public static final int ERROR

      See Also:
        Constant Field Values

    - #### FATAL

          public static final int FATAL

      See Also:
        Constant Field Values

    - #### LEVEL_STRINGS_SHORT

          protected static final String[] LEVEL_STRINGS_SHORT

      Short strings for numeric log level. Use level as array index.

    - #### LEVEL_STRINGS

          protected static final String[] LEVEL_STRINGS

      Long strings for numeric log level. Use level as array index.

  - ### Method Detail

    - #### initialize

          public abstract void initialize(String cat)

    - #### _log

          protected abstract void _log(int level,
                                       Object obj1)

      Log a message
      Parameters:
        `level` - One of DEBUG, INFO, WARN, ERROR, FATAL
        `obj1` - The object to log. This is converted to a string.

    - #### _log

          protected abstract void _log(int level,
                                       Object obj1,
                                       Throwable exception)

      Log a message
      Parameters:
        `level` - One of DEBUG, INFO, WARN, ERROR, FATAL
        `obj1` - The object to log. This is converted to a string.
        `exception` - An exception to be logged

    - #### check

          public abstract boolean check(int level)

      Check if a logger is enabled to log at the specified level This allows code to avoid building strings or evaluating functions in the arguments to log. An example: `

           if (logger.check(XBLogger.INFO)) {
               logger.log(XBLogger.INFO, "Avoid concatenating " + " strings and evaluating " + functions());
           }

      `
      Parameters:
        `level` - One of DEBUG, INFO, WARN, ERROR, FATAL

    - #### log

          public void log(int level,
                          Object... objs)

      Log a message. Lazily appends Object parameters together. If the last parameter is a `Throwable` it is logged specially.
      Parameters:
        `level` - One of DEBUG, INFO, WARN, ERROR, FATAL
        `objs` - the objects to place in the message