Package org.apache.commons.logging.impl
Class SLF4JLogFactory
java.lang.Object
org.apache.commons.logging.LogFactory
org.apache.commons.logging.impl.SLF4JLogFactory
 Concrete subclass of LogFactory which always delegates to the
 org.slf4j.LoggerFactory class.
 
 
 This factory generates instances of SLF4JLog. It will remember
 previously created instances for the same name, and will return them on
 repeated requests to the getInstance() method.
 
 
This implementation ignores any configured attributes.
- Author:
- Rod Waldhoff, Craig R. McClanahan, Richard A. Sitze, Ceki Gülcü
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected HashtableConfiguration attributes.static final StringThe name of the system property identifying ourLogimplementation class.Fields inherited from class org.apache.commons.logging.LogFactoryDIAGNOSTICS_DEST_PROPERTY, factories, FACTORY_DEFAULT, FACTORY_PROPERTIES, FACTORY_PROPERTY, HASHTABLE_IMPLEMENTATION_PROPERTY, nullClassLoaderFactory, PRIORITY_KEY, SERVICE_ID, TCCL_KEY
- 
Constructor SummaryConstructorsConstructorDescriptionPublic no-arguments constructor required by the lookup mechanism.
- 
Method SummaryModifier and TypeMethodDescriptiongetAttribute(String name) Return the configuration attribute with the specified name (if any), ornullif there is no such attribute.String[]Return an array containing the names of all currently defined configuration attributes.getInstance(Class clazz) Convenience method to derive a name from the specified class and callgetInstance(String)with it.getInstance(String name) Construct (if necessary) and return aLoginstance, using the factory's current set of configuration attributes.voidrelease()Release any internal references to previously createdLoginstances returned by this factory.voidremoveAttribute(String name) Remove any configuration attribute associated with the specified name.voidsetAttribute(String name, Object value) Set the configuration attribute with the specified name.Methods inherited from class org.apache.commons.logging.LogFactorycreateFactory, directGetContextClassLoader, getClassLoader, getContextClassLoader, getFactory, getLog, getLog, isDiagnosticsEnabled, logRawDiagnostic, newFactory, newFactory, objectId, release, releaseAll
- 
Field Details- 
LOG_PROPERTYThe name of the system property identifying ourLogimplementation class.- See Also:
 
- 
attributesConfiguration attributes.
 
- 
- 
Constructor Details- 
SLF4JLogFactorypublic SLF4JLogFactory()Public no-arguments constructor required by the lookup mechanism.
 
- 
- 
Method Details- 
getAttributeReturn the configuration attribute with the specified name (if any), ornullif there is no such attribute.- Specified by:
- getAttributein class- LogFactory
- Parameters:
- name- Name of the attribute to return
- Returns:
- configuration attribute
 
- 
getAttributeNamesReturn 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:
- getAttributeNamesin class- LogFactory
- Returns:
- names of all currently defined configuration attributes
 
- 
getInstanceConvenience method to derive a name from the specified class and callgetInstance(String)with it.- Specified by:
- getInstancein class- LogFactory
- Parameters:
- clazz- Class for which a suitable Log name will be derived
- Throws:
- LogConfigurationException- if a suitable- Loginstance cannot be returned
 
- 
getInstanceConstruct (if necessary) and return a Loginstance, using the factory's current set of configuration attributes.- Specified by:
- getInstancein class- LogFactory
- Parameters:
- name- Logical name of the- Loginstance to be returned (the meaning of this name is only known to the underlying logging implementation that is being wrapped)
- Throws:
- LogConfigurationException- if a suitable- Loginstance cannot be returned
 
- 
releaseRelease any internal references to previously createdLoginstances returned by this factory. This is useful in environments like servlet containers, which implement application reloading by throwing away a ClassLoader. Dangling references to objects in that class loader would prevent garbage collection.- Specified by:
- releasein class- LogFactory
 
- 
removeAttributeRemove any configuration attribute associated with the specified name. If there is no such attribute, no action is taken.- Specified by:
- removeAttributein class- LogFactory
- Parameters:
- name- Name of the attribute to remove
 
- 
setAttributeSet the configuration attribute with the specified name. Calling this with anullvalue is equivalent to callingremoveAttribute(name).- Specified by:
- setAttributein class- LogFactory
- Parameters:
- name- Name of the attribute to set
- value- Value of the attribute to set, or- nullto remove any setting for this attribute
 
 
-