log4j not working in WebSphere
I have a strange problem whereby my log4j logging works when deployed on tcServer but not on WebSphere 6.1. The file name that I've specified in the log4j is created. However, it is not populated even though the other Websphere logs (SystemOut.log etc) are. I've checked my WebSphere's home directory's properties directory, and there are no conflicting log4j files located there.
The strangest thing is that it works fine on tcServer so it can't be a problem with the log4j file itself. It seems like some env开发者_如何学Goironmental issue. Has anyone any ideas on how to resolve this?
Thanks
Log4j and WAS have worked for good way too many applications. So this combination is not new by any means. Do you use any wrapper for log4j (e.g Commons Logging)?
Turn on debugging for log4j.
-Dlog4j.debug=true to the WAS JVM Arguments.
This will provide information about what log4j is trying to do.
This should provide some clues to what is happening in the WAS environment.
HTH
Manglu
We had an issue a while back when we installed a JCA connector in WebSphere that came packaged with it's own log4j lib. Since connectors gets loaded into the container classloader hierarchy, the log4j lib in the connector effectively overrode the log4j in our application. It also prevented our own log4j properties from being loaded, since log4j was already bootstrapped.
It would be that you, also, have some other library or resource loaded in your WAS stack that comes with log4j. The way we got around it was doing explicit log4j initialization (reading the log4j properties) programatically in our application.
精彩评论