LogFactory instead - The default factory
implementation performs exactly the same algorithm as this class didpublic class LogSource
extends java.lang.Object
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:
depends.org.apache.commons.logging.impl.Log4JLogger.depends.org.apache.commons.logging.impl.Jdk14Logger.depends.org.apache.commons.logging.impl.NoOpLog.You can change the default behavior in one of two ways:
depends.org.apache.commons.logging.log to the name of the
depends.org.apache.commons.logging.Log implementation class
you want to use.LogSource.setLogImplementation().| 限定符和类型 | 字段和说明 |
|---|---|
protected static boolean |
jdk14IsAvailable
已过时。
Is JDK 1.4 logging available
|
protected static boolean |
log4jIsAvailable
已过时。
Is log4j available (in the current classpath)
|
protected static java.lang.reflect.Constructor |
logImplctor
已过时。
Constructor for current log class
|
protected static java.util.Hashtable |
logs
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Log |
getInstance(java.lang.Class clazz)
已过时。
Get a
Log instance by class. |
static Log |
getInstance(java.lang.String name)
已过时。
Get a
Log instance by class name. |
static java.lang.String[] |
getLogNames()
已过时。
Returns a
String array containing the names of
all logs known to me. |
static Log |
makeNewLogInstance(java.lang.String name)
已过时。
Create a new
Log implementation, based on the given name. |
static void |
setLogImplementation(java.lang.Class logclass)
已过时。
Set the log implementation/log implementation factory by class.
|
static void |
setLogImplementation(java.lang.String classname)
已过时。
Set the log implementation/log implementation factory
by the name of the class.
|
protected static java.util.Hashtable logs
protected static boolean log4jIsAvailable
protected static boolean jdk14IsAvailable
protected static java.lang.reflect.Constructor logImplctor
public static void setLogImplementation(java.lang.String classname)
throws java.lang.LinkageError,
java.lang.NoSuchMethodException,
java.lang.SecurityException,
java.lang.ClassNotFoundException
Log,
and provide a constructor that takes a single String argument
(containing the name of the log).java.lang.LinkageErrorjava.lang.NoSuchMethodExceptionjava.lang.SecurityExceptionjava.lang.ClassNotFoundExceptionpublic static void setLogImplementation(java.lang.Class logclass)
throws java.lang.LinkageError,
java.lang.ExceptionInInitializerError,
java.lang.NoSuchMethodException,
java.lang.SecurityException
Log, and provide a constructor
that takes a single String argument (containing the name of the log).java.lang.LinkageErrorjava.lang.ExceptionInInitializerErrorjava.lang.NoSuchMethodExceptionjava.lang.SecurityExceptionpublic static Log getInstance(java.lang.String name)
Log instance by class name.public static Log getInstance(java.lang.Class clazz)
Log instance by class.public static Log makeNewLogInstance(java.lang.String name)
Log implementation, based on the given name.
The specific Log implementation returned is determined by the
value of the depends.org.apache.commons.logging.log property. The value
of depends.org.apache.commons.logging.log may be set to the fully specified
name of a class that implements the Log interface. This class must
also have a public constructor that takes a single String argument
(containing the name of the Log to be constructed.
When depends.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.
name - the log name (or category)public static java.lang.String[] getLogNames()
String array containing the names of
all logs known to me.