Thursday, March 20

How to configure log4j for our web applications deployed in weblogic 10.3 domain?


The steps are given below:

1. Copy log4j-1.2.9.jar & wllog4j.jar under domain_root/lib folder.

2. Create log4j.xml and drop it under domain_root folder. If you have log4j.xml inside the application(EAR/WAR), I would recommend to move outside EAR/WAR as changing severity (log level) would require re-deployment. To avoid this, we can move log4j.xml into domain root folder but again the server needs to be bounced.

3. Login to weblogic server console. Go to Servers -> Admin Server-> Logging. Click on advanced mode. Change the logging implementation from JDK to Log4J. Click save.

4. Activate changes. Re-start the admin server.

This should enable log4j and should write logging into log file mentioned in log4j.xml or properties file.

Hang on! There is a catch here. Say now I want to change the log level from DEBUG into WARN or ERROR. How do i do? We go to log4j.xml and change the level. Now how does this change take into effect? It needs bouncing of the server.

No comments:

Post a Comment