logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: log4j in Websphere EAR and classpath problem
Date Wed, 02 Apr 2008 16:51:32 GMT
I have no specific experience with Websphere, but it's pretty clear that it is 
using parent-first classloading behavior.  I'm also guessing that you are 
using manual configuration of Log4j, at least for the webapps (a startup 
servlet or a servlet context listener, perhaps?).  In this case, the last 
applicaton loaded is the one which determines the final configuration state of 
the logger repository.

There are a couple ways to approach this....

1.  Configure parent-last (also called child-first) classloading behavior for 
the webapps

2.  Use a repository selector.  For J2EE apps, the best option is probably one 
based on JNDI.  You can find one compatible with Log4j-1.2.xx here...


You'll have to set this programmatically.  Does Websphere provide a startup 
class that runs before anything else?  Log4j 1.3 had a nice feature where it 
allowed you to set this as a system property like this....

It would be great to have this in Log4j-1.2.xx, but I'm not sure how likely 
that is to happen?


On Wed, 2 Apr 2008 10:46:53 -0400
  Yakov Khesin <ykhesin@dtcc.com> wrote:
> I have a Websphere J2EE Struts application (packaged as an EAR), which
> contains one Java project (represented by a JAR file) with its own
> log4j configuration file with loggers and appenders, and two WEB Struts
> projects, each with its own configuration file, loggers and appenders.
> Both WEB projects depend on the Java project. All appenders use
> DailyRollingFileAppender.
> My problem is that I cannot make the three projects use their own
> log4j configurations - all log messages from all three projects are
> coming to file appender from one the one WEB projects.  If I move all
> loggers and appenders confiuguration to the Java project log4j config,
> everything works, but I really need for each project to be able to use
> its own configuration file.
> Please let me know if anyone has any clues on how to make this work.
> Thank you!
> Yakov Khesin
> 212-855-1965
> -----------------------------------------
> ________________________________________________________
> DTCC DISCLAIMER: This email and any files transmitted with it are
> confidential and intended solely for the use of the individual or
> entity to whom they are addressed. If you have received this email
> in error, please notify us immediately and delete the email and any
> attachments from your system. The recipient should check this email
> and any attachments for the presence of viruses.  The company
> accepts no liability for any damage caused by any virus transmitted
> by this email.

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message