| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
  |
  +--org.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.Log4JCategoryLog.org.apache.commons.logging.impl.Jdk14Logger.org.apache.commons.logging.impl.NoOpLog.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.  This implementation ignores any
 configured attributes.
| Field Summary | |
| protected  java.util.Hashtable | attributesConfiguration attributes | 
| protected  java.util.Hashtable | instancesThe Loginstances that have
 already been created, keyed by logger name. | 
| static java.lang.String | LOG_DEFAULTThe fully qualified name of the default Logimplementation. | 
| static java.lang.String | LOG_PROPERTYThe name of the system property identifying our Logimplementation class. | 
| protected static java.lang.String | LOG_PROPERTY_OLDThe deprecated system property used for backwards compatibility with the old LogSourceclass. | 
| protected  java.lang.reflect.Constructor | logConstructorThe one-argument constructor of the Logimplementation class that will be used to create new instances. | 
| protected  java.lang.Class[] | logConstructorSignatureThe signature of the Constructor to be used. | 
| protected  java.lang.reflect.Method | logMethodThe one-argument setLogFactorymethod of the selectedLogmethod, if it exists. | 
| protected  java.lang.Class[] | logMethodSignatureThe signature of the setLogFactorymethod to be used. | 
| protected  LogFactory | proxyFactory | 
| Fields inherited from class org.apache.commons.logging.LogFactory | 
| factories, FACTORY_DEFAULT, FACTORY_PROPERTIES, FACTORY_PROPERTY, SERVICE_ID | 
| Constructor Summary | |
| LogFactoryImpl()Public no-arguments constructor required by the lookup mechanism. | |
| Method Summary | |
|  java.lang.Object | getAttribute(java.lang.String name)Return the configuration attribute with the specified name (if any), or nullif there is no such attribute. | 
|  java.lang.String[] | getAttributeNames()Return an array containing the names of all currently defined configuration attributes. | 
|  Log | getInstance(java.lang.Class clazz)Convenience method to derive a name from the specified class and call getInstance(String)with it. | 
|  Log | getInstance(java.lang.String name)Construct (if necessary) and return a Loginstance,
 using the factory's current set of configuration attributes. | 
| protected  java.lang.reflect.Constructor | getLogConstructor()Return the Constructorthat can be called to instantiate
 newLoginstances. | 
| protected  void | guessConfig() | 
| protected  boolean | isJdk14Available()Is JDK 1.4 or later logging available? | 
| protected  boolean | isLog4JAvailable()Is a Log4J implementation available? | 
| private static java.lang.Class | loadClass(java.lang.String name)MUST KEEP THIS METHOD PRIVATE | 
| protected  Log | newInstance(java.lang.String name)Create and return a new Loginstance for the specified name. | 
|  void | release()Release any internal references to previously created Loginstances returned by this factory. | 
|  void | removeAttribute(java.lang.String name)Remove any configuration attribute associated with the specified name. | 
|  void | setAttribute(java.lang.String name,
             java.lang.Object value)Set the configuration attribute with the specified name. | 
| Methods inherited from class org.apache.commons.logging.LogFactory | 
| getContextClassLoader, getFactory, getLog, getLog, newFactory, releaseAll | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public static final java.lang.String LOG_DEFAULT
Log implementation.
public static final java.lang.String LOG_PROPERTY
Log
 implementation class.
protected static final java.lang.String LOG_PROPERTY_OLD
LogSource class.
protected java.util.Hashtable attributes
protected java.util.Hashtable instances
Log instances that have
 already been created, keyed by logger name.
protected java.lang.reflect.Constructor logConstructor
Log
 implementation class that will be used to create new instances.
 This value is initialized by getLogConstructor(),
 and then returned repeatedly.
protected LogFactory proxyFactory
protected java.lang.Class[] logConstructorSignature
protected java.lang.reflect.Method logMethod
setLogFactory method of the selected
 Log method, if it exists.
protected java.lang.Class[] logMethodSignature
setLogFactory method to be used.
| Constructor Detail | 
public LogFactoryImpl()
| Method Detail | 
public java.lang.Object getAttribute(java.lang.String name)
null if there is no such attribute.
getAttribute in class LogFactoryname - Name of the attribute to returnpublic java.lang.String[] getAttributeNames()
getAttributeNames in class LogFactory
public Log getInstance(java.lang.Class clazz)
                throws LogConfigurationException
getInstance(String) with it.
getInstance in class LogFactoryclazz - Class for which a suitable Log name will be derived
LogConfigurationException - if a suitable Log
  instance cannot be returned
public Log getInstance(java.lang.String name)
                throws LogConfigurationException
Construct (if necessary) and return a 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.
getInstance in class LogFactoryname - 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)
LogConfigurationException - if a suitable Log
  instance cannot be returnedpublic void release()
Log
 instances returned by this factory.  This is useful 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.
release in class LogFactorypublic void removeAttribute(java.lang.String name)
removeAttribute in class LogFactoryname - Name of the attribute to remove
public void setAttribute(java.lang.String name,
                         java.lang.Object value)
null value is equivalent to calling
 removeAttribute(name).
setAttribute in class LogFactoryname - Name of the attribute to setvalue - Value of the attribute to set, or null
  to remove any setting for this attribute
protected java.lang.reflect.Constructor getLogConstructor()
                                                   throws LogConfigurationException
Return the Constructor that can be called to instantiate
 new Log instances.
IMPLEMENTATION NOTE - Race conditions caused by
 calling this method from more than one thread are ignored, because
 the same Constructor instance will ultimately be derived
 in all circumstances.
LogConfigurationException - if a suitable constructor
  cannot be returned
private static java.lang.Class loadClass(java.lang.String name)
                                  throws java.lang.ClassNotFoundException
Exposing this method establishes a security violation.
 This method uses AccessController.doPrivileged().
 
java.lang.ClassNotFoundExceptionprotected void guessConfig()
protected boolean isJdk14Available()
protected boolean isLog4JAvailable()
protected Log newInstance(java.lang.String name)
                   throws LogConfigurationException
Log
 instance for the specified name.
name - Name of the new logger
LogConfigurationException - if a new instance cannot
  be created| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||