Websphere all logs are going to SystemOut.log
I am using Log4j in my application and have some appenders for debug and error. I tested this on tomcat and working fine. Generating all logs in their respective files. But when I deploy code on WAS6.1 all logs are getting generated only inside SystemOut.log.
Please help!
The problem might be that WebSphere 6.1 uses Jakarta Commons Logging (JCL) internally, and if any of your code or 3rd-party libraries also use JCL, WebSphere's configuration conflicts with your application trying to use log4j. If this is happening, you'll see exactly what you're seeing.
There are multiple references and blog posts that describe ways to address this. We've found the simplest to be creating a file named org.apache.commons.logging.LogFactory
in the META-INF/services
directory of your web application (in the root of the WAR archive). This file must contain the line:
org.apache.commons.logging.impl.Log4jFactory
(At least with newer versions of WebSphere...) Another key is that the JCL jar must be loaded from the same location as the log4j jar. e.g. either both from WEB-INF/lib or both from a shared library. Thus, you can't fall back on loading JCL from WebSphere's own provided copy. If they're loaded by different classloaders, they can't properly see each other.