Slf4jLogFactory (Apache Commons Logging 1.4.0 API)
Description: declaration: package: org.apache.commons.logging.impl, class: Slf4jLogFactory

Package org.apache.commons.logging.impl

# Class Slf4jLogFactory

java.lang.Object
org.apache.commons.logging.LogFactory
org.apache.commons.logging.impl.Slf4jLogFactory

public final class Slf4jLogFactory extends LogFactory
Logger factory hardcoded to send everything to SLF4J.

Since:
  1.3.0

- ## Field Summary

  ### Fields inherited from class org.apache.commons.logging.LogFactory

  `DIAGNOSTICS_DEST_PROPERTY, factories, FACTORY_DEFAULT, FACTORY_PROPERTIES, FACTORY_PROPERTY, HASHTABLE_IMPLEMENTATION_PROPERTY, nullClassLoaderFactory, PRIORITY_KEY, SERVICE_ID, TCCL_KEY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Slf4jLogFactory()`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `getAttribute(String name)`
  Gets the configuration attribute with the specified name (if any), or `null` if there is no such attribute.
  `String[]`
  `getAttributeNames()`
  Gets an array containing the names of all currently defined configuration attributes.
  `Log`
  `getInstance(Class<?> clazz)`
  Gets a Log for the given class.
  `Log`
  `getInstance(String name)`
  Gets a (possibly new) `Log` instance, using the factory's current set of configuration attributes.
  `void`
  `release()`
  This method is supposed to clear all loggers.
  `void`
  `removeAttribute(String name)`
  Removes any configuration attribute associated with the specified name.
  `void`
  `setAttribute(String name, Object value)`
  Sets the configuration attribute with the specified name.

  ### Methods inherited from class org.apache.commons.logging.LogFactory

  `createFactory, directGetContextClassLoader, getClassLoader, getContextClassLoader, getFactory, getLog, getLog, handleThrowable, isDiagnosticsEnabled, logRawDiagnostic, newFactory, newFactory, objectId, release, releaseAll`

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

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

- ## Constructor Details

  - ### Slf4jLogFactory

    public Slf4jLogFactory()
    Constructs a new instance.

- ## Method Details

  - ### getAttribute

    public Object getAttribute(String name)
    Description copied from class: `LogFactory`
    Gets the configuration attribute with the specified name (if any), or `null` if there is no such attribute.
    Specified by:
      `getAttribute` in class `LogFactory`
    Parameters:
      `name` - Name of the attribute to return
    Returns:
      the configuration attribute with the specified name.

  - ### getAttributeNames

    public String[] getAttributeNames()
    Description copied from class: `LogFactory`
    Gets an array containing the names of all currently defined configuration attributes. If there are no such attributes, a zero length array is returned.
    Specified by:
      `getAttributeNames` in class `LogFactory`
    Returns:
      an array containing the names of all currently defined configuration attributes

  - ### getInstance

    public Log getInstance(Class<?> clazz) throws LogConfigurationException
    Description copied from class: `LogFactory`
    Gets a Log for the given class.
    Specified by:
      `getInstance` in class `LogFactory`
    Parameters:
      `clazz` - Class for which a suitable Log name will be derived
    Returns:
      a name from the specified class.
    Throws:
      `LogConfigurationException` - if a suitable `Log` instance cannot be returned

  - ### getInstance

    public Log getInstance(String name)
    Description copied from class: `LogFactory`
    Gets a (possibly new) `Log` instance, using the factory's current set of configuration attributes.

    NOTE - Depending upon the implementation of the `LogFactory` you are using, the `Log` instance you are returned may or may not be local to the current application, and may or may not be returned again on a subsequent call with the same name argument.

    Specified by:
      `getInstance` in class `LogFactory`
    Parameters:
      `name` - Logical name of the `Log` instance to be returned (the meaning of this name is only known to the underlying logging implementation that is being wrapped)
    Returns:
      a `Log` instance.

  - ### release

    public void release()
    This method is supposed to clear all loggers.

    In this implementation it calls a "stop" method if the logger factory supports it. This is the case of Logback.

    Specified by:
      `release` in class `LogFactory`

  - ### removeAttribute

    public void removeAttribute(String name)
    Description copied from class: `LogFactory`
    Removes any configuration attribute associated with the specified name. If there is no such attribute, no action is taken.
    Specified by:
      `removeAttribute` in class `LogFactory`
    Parameters:
      `name` - Name of the attribute to remove

  - ### setAttribute

    public void setAttribute(String name, Object value)
    Description copied from class: `LogFactory`
    Sets the configuration attribute with the specified name. Calling this with a `null` value is equivalent to calling `removeAttribute(name)`.
    Specified by:
      `setAttribute` in class `LogFactory`
    Parameters:
      `name` - Name of the attribute to set
      `value` - Value of the attribute to set, or `null` to remove any setting for this attribute