LogUtils (Apache CXF JavaDoc 3.0.4.redhat-621177 API)

org.apache.cxf.common.logging

## Class LogUtils

- java.lang.Object
- - org.apache.cxf.common.logging.LogUtils

-     public final class LogUtils
      extends Object

  A container for static utility methods related to logging. By default, CXF logs to java.util.logging. An application can change this. To log to another system, the application must provide an object that extends `AbstractDelegatingLogger`, and advertise that class via one of the following mechanisms:
  - Create a file, in the classpath, named META-INF/cxf/org.apache.cxf.Logger. This file should contain the fully-qualified name of the class, with no comments, on a single line.
  - Call `setLoggerClass(Class)` with a Class reference to the logger class.
  CXF provides `Log4jLogger` to use log4j instead of java.util.logging.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `KEY`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static Logger` | `createLogger(Class<?> cls, String name, String loggerName)` Create a logger
    `static Logger` | `getL7dLogger(Class<?> cls)` Get a Logger with the associated default resource bundle for the class.
    `static Logger` | `getL7dLogger(Class<?> cls, String resourcename)` Get a Logger with an associated resource bundle.
    `static Logger` | `getL7dLogger(Class<?> cls, String resourcename, String loggerName)` Get a Logger with an associated resource bundle.
    `static Logger` | `getLogger(Class<?> cls)` Get a Logger with the associated default resource bundle for the class.
    `static Logger` | `getLogger(Class<?> cls, String resourcename)` Get a Logger with an associated resource bundle.
    `static Logger` | `getLogger(Class<?> cls, String resourcename, String loggerName)` Get a Logger with an associated resource bundle.
    `static void` | `log(Logger logger, Level level, String message)` Checks log level and logs
    `static void` | `log(Logger logger, Level level, String message, Object parameter)` Checks log level and logs
    `static void` | `log(Logger logger, Level level, String message, Object[] parameters)` Checks log level and logs
    `static void` | `log(Logger logger, Level level, String message, Throwable throwable)` Checks log level and logs
    `static void` | `log(Logger logger, Level level, String message, Throwable throwable, Object... parameters)` Allows both parameter substitution and a typed Throwable to be logged.
    `static void` | `log(Logger logger, Level level, String message, Throwable throwable, Object parameter)` Allows both parameter substitution and a typed Throwable to be logged.
    `static void` | `setLoggerClass(Class<? extends AbstractDelegatingLogger> cls)` Specify a logger class that inherits from `AbstractDelegatingLogger`.

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

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

- - ### Field Detail

    - #### KEY

          public static final String KEY

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### setLoggerClass

          public static void setLoggerClass(Class<? extends AbstractDelegatingLogger> cls)

      Specify a logger class that inherits from `AbstractDelegatingLogger`. Enable users to use their own logger implementation.

    - #### getLogger

          public static Logger getLogger(Class<?> cls)

      Get a Logger with the associated default resource bundle for the class.
      Parameters:
        `cls` - the Class to contain the Logger
      Returns:
        an appropriate Logger

    - #### getLogger

          public static Logger getLogger(Class<?> cls,
                         String resourcename)

      Get a Logger with an associated resource bundle.
      Parameters:
        `cls` - the Class to contain the Logger
        `resourcename` - the resource name
      Returns:
        an appropriate Logger

    - #### getLogger

          public static Logger getLogger(Class<?> cls,
                         String resourcename,
                         String loggerName)

      Get a Logger with an associated resource bundle.
      Parameters:
        `cls` - the Class to contain the Logger (to find resources)
        `resourcename` - the resource name
        `loggerName` - the full name for the logger
      Returns:
        an appropriate Logger

    - #### getL7dLogger

          public static Logger getL7dLogger(Class<?> cls)

      Get a Logger with the associated default resource bundle for the class.
      Parameters:
        `cls` - the Class to contain the Logger
      Returns:
        an appropriate Logger

    - #### getL7dLogger

          public static Logger getL7dLogger(Class<?> cls,
                            String resourcename)

      Get a Logger with an associated resource bundle.
      Parameters:
        `cls` - the Class to contain the Logger
        `resourcename` - the resource name
      Returns:
        an appropriate Logger

    - #### getL7dLogger

          public static Logger getL7dLogger(Class<?> cls,
                            String resourcename,
                            String loggerName)

      Get a Logger with an associated resource bundle.
      Parameters:
        `cls` - the Class to contain the Logger (to find resources)
        `resourcename` - the resource name
        `loggerName` - the full name for the logger
      Returns:
        an appropriate Logger

    - #### createLogger

          protected static Logger createLogger(Class<?> cls,
                            String name,
                            String loggerName)

      Create a logger

    - #### log

          public static void log(Logger logger,
                 Level level,
                 String message,
                 Throwable throwable,
                 Object parameter)

      Allows both parameter substitution and a typed Throwable to be logged.
      Parameters:
        `logger` - the Logger the log to
        `level` - the severity level
        `message` - the log message
        `throwable` - the Throwable to log
        `parameter` - the parameter to substitute into message

    - #### log

          public static void log(Logger logger,
                 Level level,
                 String message,
                 Throwable throwable,
                 Object... parameters)

      Allows both parameter substitution and a typed Throwable to be logged.
      Parameters:
        `logger` - the Logger the log to
        `level` - the severity level
        `message` - the log message
        `throwable` - the Throwable to log
        `parameters` - the parameters to substitute into message

    - #### log

          public static void log(Logger logger,
                 Level level,
                 String message)

      Checks log level and logs
      Parameters:
        `logger` - the Logger the log to
        `level` - the severity level
        `message` - the log message

    - #### log

          public static void log(Logger logger,
                 Level level,
                 String message,
                 Throwable throwable)

      Checks log level and logs
      Parameters:
        `logger` - the Logger the log to
        `level` - the severity level
        `message` - the log message
        `throwable` - the Throwable to log

    - #### log

          public static void log(Logger logger,
                 Level level,
                 String message,
                 Object parameter)

      Checks log level and logs
      Parameters:
        `logger` - the Logger the log to
        `level` - the severity level
        `message` - the log message
        `parameter` - the parameter to substitute into message

    - #### log

          public static void log(Logger logger,
                 Level level,
                 String message,
                 Object[] parameters)

      Checks log level and logs
      Parameters:
        `logger` - the Logger the log to
        `level` - the severity level
        `message` - the log message
        `parameters` - the parameters to substitute into message

Apache CXF