commons-logging-1.0.4.jar 使用
Configuring the Commons Logging Package
Choosing a LogFactory
Implementation
From an application perspective, the first requirement is to retrieve an object reference to the LogFactory
instance that will be used to create Log
instances for this application. This is normally accomplished by calling the static getFactory()
method. This method implements the following discovery algorithm to select the name of the LogFactory
implementation class this application wants to use:
- Check for a system property named
org.apache.commons.logging.LogFactory
.
- Use the JDK 1.3 JAR Services Discovery mechanism (see http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html for more information) to look for a resource named
META-INF/services/org.apache.commons.logging.LogFactory
whose first line is assumed to contain the desired class name.
- Look for a properties file named
commons-logging.properties
visible in the application class path, with a property named org.apache.commons.logging.LogFactory
defining the desired implementation class name.
- Fall back to a default implementation, which is described further below.
If a commons-logging.properties
file is found, all of the properties defined there are also used to set configuration attributes on the instantiated LogFactory
instance.
使用必须:
commons-logging-1.0.4.jar
log4j-1.2.9.jar
log4j.properties
posted on 2005-08-11 22:22
R.Zeus 阅读(1245)
评论(0) 编辑 收藏 所属分类:
Log4j