The commons-logging API is used by WebSphere for its internal logging. IBM has choosen to use a proprietary log
implementation com.ibm.ws.commons.logging.TrLog. This means that if another log implementation is to be used (e.g. log4j), the commons logging configuration has to be overridden, i.e. by specifying a different
LogFactory than the one used by IBM.
Specifying the commons-logging
LogFactory to use can be done by adding a system property or by creating a properties file
commons-logging.properties in the root class path. The file should contain the following line:
(All in one line)
This ensures that the default
LogFactory is used. The default
LogFactory uses a simple algorithm to choose the log implementation, please refer to the
… for details. In short log4j will be used if the log4j api is found on the classpath; otherwise JDK1.4 logging is used. If yet another log implementation is desired a customized LogFactory can be developed.
Important: Placing a commons-logging.properties on the class path means that the IBM WebSphere 5.1 runtime has to be placed after the class path entry containing the commons-logging.properties file!
Of course since we are dealing with IBM and J2EE it can get a lot more complicated than this as evidenced by IBMs white paper (Google for “commons logging site:ibm.com”)