wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes commons logging : unable to configure proper logger class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "commons logging : unable to configure proper logger class" Watch "commons logging : unable to configure proper logger class" New topic
Author

commons logging : unable to configure proper logger class

Romit Bose
Ranch Hand

Joined: Oct 03, 2007
Posts: 50
Hi,
Greetings, All!
We are having an issue with logging, which is as follows :
We are trying to use commons logging for logging purpose.
We have put our 'commons-logging.properties' file in the WEB-INF/classes folder and it has the following 2 entries:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
org.apache.commons.logging.simplelog.log.LogonAction=info

When we run our application the Log should use the 'Log4JLogger', as defined in 'commons-logging.properties'. BUT it uses the default logger for my environment org.apache.commons.logging.impl.Jdk14Logger!
How can we configure logging to use 'Log4JLogger'.... any examples will be very helpful.

For a ready reference, this is what the logging guide in the apache site says :

"There are two base abstractions used by JCL: Log (the basic logger) and LogFactory (which knows how to create Log instances). Specifying a particular Log implementation is very useful (whether that is one provided by commons-logging or a user-defined one). Specifying a LogFactory implementation other than the default is a subject for advanced users only, so will not be addressed here. The default LogFactory implementation uses the following discovery process to determine what type of Log implementation it should use (the process terminates when the first positive match - in order - is found):
Look for a configuration attribute of this factory named org.apache.commons.logging.Log (for backwards compatibility to pre-1.0 versions of this API, an attribute org.apache.commons.logging.log is also consulted). Configuration attributes can be set explicitly by java code, but they are more commonly set by placing a file named commons-logging.properties in the classpath. When such a file exists, every entry in the properties file becomes an "attribute" of the LogFactory. When there is more than one such file in the classpath, releases of commons-logging prior to 1.1 simply use the first one found. From release 1.1, each file may define a priority key, and the file with the highest priority is used (no priority definition implies priority of zero). When multiple files have the same priority, the first one found is used. Defining this property in a commons-logging.properties file is the recommended way of explicitly selecting a Log implementation.
Look for a system property named org.apache.commons.logging.Log (for backwards compatibility to pre-1.0 versions of this API, a system property org.apache.commons.logging.log is also consulted).
If the Log4J logging system is available in the application class path, use the corresponding wrapper class (Log4JLogger).
If the application is executing on a JDK 1.4 system, use the corresponding wrapper class (Jdk14Logger).
Fall back to the default simple logging wrapper (SimpleLog).
"


Thanks In Advance!
 
jQuery in Action, 2nd edition
 
subject: commons logging : unable to configure proper logger class
 
Similar Threads
Will someone put log4j usage into small words?
WAS 5.1 using Struts 1.2.9 - commons-logging issue
log4j and apache.commons.logging
NX: which logging file?
send server output to log file