You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Charlie Toohey <ct...@pacbell.net> on 2003/01/20 18:46:00 UTC
commons logging configuration
I am trying to use commons logging with SimpleLog, and can get it to work,
but what I've found does not correspond with the commons logging javadoc
documentation when it comes to the commons-logging.properties file.
Per the documentation, the default LogFactory implementation chooses the
underlying log implementation in the following order:
1. look for system property org.apache.common.logging.Log
2. look for configuration attribute of the factory named
org.apache.commons.logging.Log
3. use Log4J if in the app class path
4. use JDK 1.4 if in app class path
5. use no output
I do not have Log4J in the class path and I am using JDK 1.4. My app is a
webapp running in Tomcat.
To choose SimpleLog, I put a commons-logging.properties file in the
WEB-INF/classes directory with the following:
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
However, even though SimpleLog is being specified as a configuration
attribute of the default LogFactory implementaion, commons logging chooses
Jdk14Logger. The javadocs state that the factory config attribute should be
considered before Jdk14Logger.
By the way, if I define SimpleLog as a system property on starting Catalina,
then commons logging correctly chooses SimpleLog:
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
So I can get SimpleLog, but am wondering why I can't choose it using
commons-logging.properties.
So in a nutshell, either the javadocs are wrong (and commons logging chooses
Jdk14Logger before it looks at the factory configuration attributes in
commons-logging.properties), or, commons logging is ignoring my
commons-logging.properties file for some reason, or I'm doing something wrong.
By the way, when I choose SimpleLog via the system property method, the
simplelog.properties file is used correctly, and that is also in
WEB-INF/classes, so I don't think there is a problem with
commons-logging.properties not being in the class path.
Any insight ?
Charlie