java.lang.Objectorg.apache.commons.logging.LogFactory
org.apache.commons.logging.impl.LogFactoryImpl
Concrete subclass of LogFactory that implements the following algorithm to dynamically select a logging implementation class to instantiate a wrapper for.
org.apache.commons.logging.Log
to identify the
requested implementation class.org.apache.commons.logging.Log
system property
to identify the requested implementation class.org.apache.commons.logging.impl.Log4JLogger
.org.apache.commons.logging.impl.Jdk14Logger
.org.apache.commons.logging.impl.SimpleLog
.If the selected Log implementation class has a
setLogFactory()
method that accepts a LogFactory
parameter, this method will be called on each newly created instance
to identify the associated factory. This makes factory configuration
attributes available to the Log instance, if it so desires.
This factory will remember previously created Log
instances
for the same name, and will return them on repeated requests to the
getInstance()
method.
Rod
- WaldhoffCraig
- R. McClanahanRichard
- A. SitzeBrian
- Stansberry$
- Revision: 581090 $ $Date: 2007-10-02 00:01:06 +0200 (ti, 02 okt 2007) $Field Summary | ||
---|---|---|
public static final String | LOG_PROPERTY | The name (org.apache.commons.logging.Log ) of the system
property identifying our Log implementation class. |
protected static final String | LOG_PROPERTY_OLD | The deprecated system property used for backwards compatibility with old versions of JCL. |
public static final String | ALLOW_FLAWED_CONTEXT_PROPERTY | The name (org.apache.commons.logging.Log.allowFlawedContext )
of the system property which can be set true/false to
determine system behaviour when a bad context-classloader is encountered.
When set to false, a LogConfigurationException is thrown if
LogFactoryImpl is loaded via a child classloader of the TCCL (this
should never happen in sane systems).
Default behaviour: true (tolerates bad context classloaders)
See also method setAttribute. |
public static final String | ALLOW_FLAWED_DISCOVERY_PROPERTY | The name (org.apache.commons.logging.Log.allowFlawedDiscovery )
of the system property which can be set true/false to
determine system behaviour when a bad logging adapter class is
encountered during logging discovery. When set to false, an
exception will be thrown and the app will fail to start. When set
to true, discovery will continue (though the user might end up
with a different logging implementation than they expected).
Default behaviour: true (tolerates bad logging adapters)
See also method setAttribute. |
public static final String | ALLOW_FLAWED_HIERARCHY_PROPERTY | The name (org.apache.commons.logging.Log.allowFlawedHierarchy )
of the system property which can be set true/false to
determine system behaviour when a logging adapter class is
encountered which has bound to the wrong Log class implementation.
When set to false, an exception will be thrown and the app will fail
to start. When set to true, discovery will continue (though the user
might end up with a different logging implementation than they expected).
Default behaviour: true (tolerates bad Log class hierarchy)
See also method setAttribute. |
protected Hashtable | attributes | Configuration attributes. |
protected Hashtable | instances | The org.apache.commons.logging.Log instances that have already been created, keyed by logger name. |
protected Constructor | logConstructor | The one-argument constructor of the
org.apache.commons.logging.Log
implementation class that will be used to create new instances.
This value is initialized by getLogConstructor() ,
and then returned repeatedly. |
protected Class[] | logConstructorSignature | The signature of the Constructor to be used. |
protected Method | logMethod | The one-argument setLogFactory method of the selected
org.apache.commons.logging.Log method, if it exists. |
protected Class[] | logMethodSignature | The signature of the setLogFactory method to be used. |
Constructor: |
---|
|
Method from org.apache.commons.logging.impl.LogFactoryImpl Summary: |
---|
getAttribute, getAttributeNames, getClassLoader, getContextClassLoader, getInstance, getInstance, getLogClassName, getLogConstructor, isDiagnosticsEnabled, isJdk13LumberjackAvailable, isJdk14Available, isLog4JAvailable, logDiagnostic, newInstance, release, removeAttribute, setAttribute |
Methods from org.apache.commons.logging.LogFactory: |
---|
access$0, class$, createFactory, directGetContextClassLoader, getAttribute, getAttributeNames, getClassLoader, getContextClassLoader, getFactory, getInstance, getInstance, getLog, getLog, isDiagnosticsEnabled, logRawDiagnostic, newFactory, newFactory, objectId, release, release, releaseAll, removeAttribute, setAttribute |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.commons.logging.impl.LogFactoryImpl Detail: |
---|
null if there is no such attribute. |
|
|
|
getInstance(String) with it. |
Construct (if necessary) and return a NOTE - Depending upon the implementation of
the |
Deprecated! Never - invoked by this class; subclasses should not assume
it will be.
|
Deprecated! Never - invoked by this class; subclasses should not assume
it will be.Return the IMPLEMENTATION NOTE - Race conditions caused by
calling this method from more than one thread are ignored, because
the same |
|
Deprecated! Never - invoked by this class; subclasses should not assume
it will be.
|
Deprecated! Never - invoked by this class; subclasses should not assume
it will be.Return |
Deprecated! Never - invoked by this class; subclasses should not assume
it will be.
|
|
|
|
|
null value is equivalent to calling
removeAttribute(name) .
This method can be used to set logging configuration programmatically rather than via system properties. It can also be used in code running within a container (such as a webapp) to configure behaviour on a per-component level instead of globally as system properties would do. To use this method instead of a system property, call LogFactory.getFactory().setAttribute(...)This must be done before the first Log object is created; configuration changes after that point will be ignored. This method is also called automatically if LogFactory detects a commons-logging.properties file; every entry in that file is set automatically as an attribute here. |