Solved

log4j with multiple apps in WebSphere

Posted on 2014-04-16
4
948 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
twoTwo  challenge 35 85
wordsFront challenge 8 65
hasOne  challenge 59 87
countX 22 68
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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now