Class LogSource
Factory for creating Log
instances. Applications should call
the makeNewLogInstance()
method to instantiate new instances
of the configured Log
implementation 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.log
to the name of theorg.apache.commons.logging.Log
implementation class you want to use. - At runtime, call
LogSource.setLogImplementation()
.
- Version:
- $Id: LogSource.java,v 1.1 2008-11-30 10:57:27 mchyzer Exp $
-
Field Summary
Modifier and TypeFieldDescriptionprotected static boolean
Deprecated.Is JDK 1.4 logging availableprotected static boolean
Deprecated.Is log4j available (in the current classpath)protected static Constructor
Deprecated.Constructor for current log classprotected static Hashtable
Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic Log
getInstance
(Class clazz) Deprecated.Get aLog
instance by classstatic Log
getInstance
(String name) Deprecated.Get aLog
instance by class namestatic String[]
Deprecated.Returns aString
array containing the names of all logs known to me.static Log
makeNewLogInstance
(String name) Deprecated.Create a newLog
implementation, based on the given name.static void
setLogImplementation
(Class logclass) Deprecated.Set the log implementation/log implementation factory by class.static void
setLogImplementation
(String classname) Deprecated.Set the log implementation/log implementation factory by the name of the class.
-
Field Details
-
logs
Deprecated. -
log4jIsAvailable
protected static boolean log4jIsAvailableDeprecated.Is log4j available (in the current classpath) -
jdk14IsAvailable
protected static boolean jdk14IsAvailableDeprecated.Is JDK 1.4 logging available -
logImplctor
Deprecated.Constructor for current log class
-
-
Method Details
-
setLogImplementation
public static void setLogImplementation(String classname) throws LinkageError, ExceptionInInitializerError, NoSuchMethodException, SecurityException, ClassNotFoundException Deprecated. -
setLogImplementation
public static void setLogImplementation(Class logclass) throws LinkageError, ExceptionInInitializerError, NoSuchMethodException, SecurityException Deprecated. -
getInstance
Deprecated.Get aLog
instance by class name -
getInstance
Deprecated.Get aLog
instance by class -
makeNewLogInstance
Deprecated.Create a newLog
implementation, based on the given name.The specific
Log
implementation 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 theLog
interface. This class must also have a public constructor that takes a singleString
argument (containing the name of theLog
to 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
Deprecated.Returns aString
array containing the names of all logs known to me.
-
LogFactory
instead - The default factory implementation performs exactly the same algorithm as this class did