Class LogSource
- java.lang.Object
 - 
- org.apache.commons.logging.LogSource
 
 
- 
public class LogSource extends java.lang.ObjectDeprecated.UseLogFactoryinstead - The default factory implementation performs exactly the same algorithm as this class didFactory for creatingLoginstances. Applications should call themakeNewLogInstance()method to instantiate new instances of the configuredLogimplementation class.By default, calling
getInstance()will use the following algorithm:- If Log4J is available, return an instance of
     
org.apache.commons.logging.impl.Log4JLogger. - If JDK 1.4 or later is available, return an instance of
     
org.apache.commons.logging.impl.Jdk14Logger. - Otherwise, return an instance of
     
org.apache.commons.logging.impl.NoOpLog. 
You can change the default behavior in one of two ways:
- On the startup command line, set the system property
     
org.apache.commons.logging.logto the name of theorg.apache.commons.logging.Logimplementation class you want to use. - At runtime, call 
LogSource.setLogImplementation(). 
- Version:
 - $Id: LogSource.java 1432675 2013-01-13 17:53:30Z tn $
 
 - If Log4J is available, return an instance of
     
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected static booleanjdk14IsAvailableDeprecated.Is JDK 1.4 logging availableprotected static booleanlog4jIsAvailableDeprecated.Is log4j available (in the current classpath)protected static java.lang.reflect.ConstructorlogImplctorDeprecated.Constructor for current log classprotected static java.util.HashtablelogsDeprecated. 
- 
Constructor Summary
Constructors Modifier Constructor Description privateLogSource()Deprecated.Don't allow others to create instances. 
- 
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static LoggetInstance(java.lang.Class clazz)Deprecated.Get aLoginstance by class.static LoggetInstance(java.lang.String name)Deprecated.Get aLoginstance by class name.static java.lang.String[]getLogNames()Deprecated.Returns aStringarray containing the names of all logs known to me.static LogmakeNewLogInstance(java.lang.String name)Deprecated.Create a newLogimplementation, based on the given name.static voidsetLogImplementation(java.lang.Class logclass)Deprecated.Set the log implementation/log implementation factory by class.static voidsetLogImplementation(java.lang.String classname)Deprecated.Set the log implementation/log implementation factory by the name of the class. 
 - 
 
- 
- 
Field Detail
- 
logs
protected static java.util.Hashtable logs
Deprecated. 
- 
log4jIsAvailable
protected static boolean log4jIsAvailable
Deprecated.Is log4j available (in the current classpath) 
- 
jdk14IsAvailable
protected static boolean jdk14IsAvailable
Deprecated.Is JDK 1.4 logging available 
- 
logImplctor
protected static java.lang.reflect.Constructor logImplctor
Deprecated.Constructor for current log class 
 - 
 
- 
Method Detail
- 
setLogImplementation
public static void setLogImplementation(java.lang.String classname) throws java.lang.LinkageError, java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.ClassNotFoundExceptionDeprecated.Set the log implementation/log implementation factory by the name of the class. The given class must implementLog, and provide a constructor that takes a singleStringargument (containing the name of the log).- Throws:
 java.lang.LinkageErrorjava.lang.NoSuchMethodExceptionjava.lang.SecurityExceptionjava.lang.ClassNotFoundException
 
- 
setLogImplementation
public static void setLogImplementation(java.lang.Class logclass) throws java.lang.LinkageError, java.lang.ExceptionInInitializerError, java.lang.NoSuchMethodException, java.lang.SecurityExceptionDeprecated.Set the log implementation/log implementation factory by class. The given class must implementLog, and provide a constructor that takes a singleStringargument (containing the name of the log).- Throws:
 java.lang.LinkageErrorjava.lang.ExceptionInInitializerErrorjava.lang.NoSuchMethodExceptionjava.lang.SecurityException
 
- 
getInstance
public static Log getInstance(java.lang.String name)
Deprecated.Get aLoginstance by class name. 
- 
getInstance
public static Log getInstance(java.lang.Class clazz)
Deprecated.Get aLoginstance by class. 
- 
makeNewLogInstance
public static Log makeNewLogInstance(java.lang.String name)
Deprecated.Create a newLogimplementation, based on the given name.The specific
Logimplementation returned is determined by the value of the org.apache.commons.logging.log property. The value of org.apache.commons.logging.log may be set to the fully specified name of a class that implements theLoginterface. This class must also have a public constructor that takes a singleStringargument (containing the name of theLogto be constructed.When org.apache.commons.logging.log is not set, or when no corresponding class can be found, this method will return a Log4JLogger if the log4j Logger class is available in the
LogSource's classpath, or a Jdk14Logger if we are on a JDK 1.4 or later system, or NoOpLog if neither of the above conditions is true.- Parameters:
 name- the log name (or category)
 
- 
getLogNames
public static java.lang.String[] getLogNames()
Deprecated.Returns aStringarray containing the names of all logs known to me. 
 - 
 
 -