Hi all, I've been seeing a number of people having problems with Jakarta Commons Logging (JCL) and Websphere. Indeed, Websphere provides a JCL provider which means that by default, if your application uses (or its third party library uses) JCL, it will be logged by JRAS, the Websphere logging infrastructure. I was myself very frustrated about not being able to have individual log files for my applications, so I started to look into a workaround that would enable my apps to use Log4J as the underlying logging infrastructure. Ideally, I wanted to: - use JRAS when used by Websphere classes - use Log4J when used by my applications Also, I did not want to change the classloading settings for any applications to PARENT_LAST and to keep the default Websphere settings, as using PARENT_LAST is often source of linkage errors. The solution I found involves adding a file named org.apache.commons.logging.LogFactory in the META-INF/services directory of your EJB JARs or WARs. This file would contain the following line (if Log4J is to be used): org.apache.commons.logging.impl.Log4JLogger Obviously, you also need to have the following in your classpath: - log4j.properties (in WEB-INF/classes or at the root of your EJB-JAR) - commons-logging.jar - log4j.jar In the case of WARs, the JCL and log4j libraries need to be in the WEB-INF/lib folder. For EARs, the Class-Path entry of the MANIFEST of your EJB-JARs must contain a relative path to these libraries and the libraries must be packaged in your EAR. Hope this helps. [ January 13, 2004: Message edited by: Beno�t d'Oncieu ]
...and if you want to motivate IBM to fix this so you don't have to do goofy things like change the classloader mode, you can petition them to fix this problem here: http://www7b.software.ibm.com/webapp/wsdd/wasServlet3 It's item number 241 in the feature request database, which was offline for an astounding length of time but appears to be working again (for now).
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Joined: Dec 19, 2002
BTW, did you get this to work for a simple (non-EJB) EAR or WAR project? I just tried it in WSAD and it didn't work there...
Joined: Nov 22, 2008
David, I'm not sure about WASAD as I'm not using it, but it should work the same. If you read carefully my original post, I do explain how to make it work for WAR files. Cheers,