Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

log4j with multiple apps in WebSphere

Posted on 2014-04-16
4
Medium Priority
?
1,170 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
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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 …
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
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
Course of the Month20 days, 21 hours left to enroll

810 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