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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…