Solved

log4j with multiple apps in WebSphere

Posted on 2014-04-16
4
1,076 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 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
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.

719 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