Solved

log4j with multiple apps in WebSphere

Posted on 2014-04-16
4
991 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 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
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.

777 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