on 07-15-2005 9:28 PM
Hello!
Has anybody been able to get log4j to work with Web AS. Am not able to log messages with log4j. SAP logging works.
Can some one throw some light?
Thanks
/Ray
We use log4j in our app as well. What we do is put the log4j jar in the EAR file. We then have a servlet which is marked to load-on-startup whose only purpose to call the PropertyConfigurator class with the log4j.properties file location.
I suppose you can do the same thing, getting the log4j.properties using the context class loader from the thread. This way you can put your log4j.properties file in the WEB-INF/classes directory in your war file.
I'm still trying to find out what kind of classloading scheme the application is using. But if it is the same as tomcat, websphere, then you should be able to get away with putting log4j.jar in your WEB-INF/lib directory and log4j.properties in WEB-INF/classes. And not bother with the servlet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help. I managed to resolve the problem. My log4j.properties was not getting loaded. I managed to get log4j.properties loaded by dropping it in a folder on the server file system and have PropertyConfigurator pick it up.
I am not sure why the classloader wasn't able to load log4j.properties from a jar file. I will try WEB-INF/classes/log4j.properties that I believe should also work.
I believe SAP uses commons.logging which will allow a unique interface regardless of the logging implementation whether it be log4j or java.util.logging.*
Enjoy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has anybody been able to get log4j to work with Web AS, does log4j.jar need to be dropped in a system lib folder? I have the log4.jar and the properties file in a web app and the logging does not work. The same setup works on jboss, bes, websphere.
Can anybody share their experience setting up log4j with Web AS?
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.