cancel
Showing results for 
Search instead for 
Did you mean: 

Log4j setup in WEB AS

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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?