?
Solved

log4j with multiple apps in WebSphere

Posted on 2014-04-16
4
Medium Priority
?
1,108 Views
Last Modified: 2014-04-21
I'm deploying an application in WebSphere on a server with other applications already deployed.  I have log4j configured in a log4j.xml that is under WEB-INF/classes in the war and is deployed correctly on the server.  I'm using a RollingFileAppender that designates a log file and DEBUG level output.  In local testing, the log file is created and DEBUG level statements are written to it.

Under WebSphere, all log4j output goes to SystemOut.log, and only INFO level output is written.  I've studied the other deployed applications, and one of the others has the same result as my application - output at INFO level only going to SystemOut.log.  Only one application seems to be able to create the log file designated in its log4j.xml and get the desired output level.

I've tried to explicitly initialize log4j but it has no effect.  The server has a "Multiple" classloader policy with "parent class loader first".

So my question is whether anyone knows if this is a WebSphere limitation that only allows one log4j configuration per server.  Or am I just missing a step.

Thx.
0
Comment
Question by:jkavx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:jkavx
ID: 40010961
I set debug=true in log4j.xml.  Locally, I see the details of how log4j reads the configuration.  On the server, I don't see any of this, even though log4j output from INFO up  is going to SystemOut.log.
0
 
LVL 12

Accepted Solution

by:
Sharon Seth earned 2000 total points
ID: 40012052
Where is the log4j.properites file on the server ? It's possible that the server deployment is not using the same prop file that is used in the local deployment.
0
 

Author Comment

by:jkavx
ID: 40012682
I'm using log4.j.xml.  It's in the war file under WEB-INF/classes.  I've confirmed that it's deployed correctly on the WebSphere server at ./was/INSTANCE1/profiles/base/installedApps/nd_cellname/Cms.ear/cms.war/WEB-INF/classes/log4j.xml.
0
 

Author Closing Comment

by:jkavx
ID: 40013995
For some reason, in WebSphere I needed to explicitly instantiate log4j.xml.  Even though I was actually trying to do this, the issue I had was that I was using the PropertyConfigurator to configure an XML file, instead of  the DOMConfigurator.
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question