tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <remy.mauche...@gmail.com>
Subject Re: How to approximate tomcat-5.0/4.x/3.x logging in 5.5?
Date Wed, 02 Mar 2005 18:41:26 GMT
On Wed,  2 Mar 2005 11:09:56 -0600, Jacob Kjome <hoju@visi.com> wrote:
> Quoting Adrian Robert <arobert@cogsci.ucsd.edu>:
> exists.  This would continue to make Tomcat-5.5 more involved in logging than
> it should, though.  I think Yoav Shapira has it right when he says that Tomcat
> should not really be directly involved in logging, but use the external
> implementation.  I'm not sure what the solution is.  Probably needs more
> discussion.

That's the idea. Logging services should be "external", rather than
proprietary to Tomcat. the problem comes that we need some kind of
defaults (like the current one, which is "use whatever
java.util.logging defaults are configured").

> > Hmm..  I'm using log4j-1.2.9.  I had the jar in both places but wasn't
> > getting the isolation since my webapp was still pumping things into
> > tomcat.log according to the container's log4j.properties..  However,
> > I'm creating the logger in a static block in one of my webapp's classes
> > -- could that have been the issue?
> 
> Do you have webapp libraries sitting in a shared classloader such as shared/lib
> or common/lib?  That would do it.
> 
> 1.  Make sure all your application classes are in WEB-INF/lib or WEB-INF/classes
> 
> 2.  Make sure log4j.jar is in WEB-INF/lib (remove commons-logging.jar if it is
> there.  If you don't specifically need it, it can, and will, cause problems for
> you)
> 
> 3.  Make sure log4j.jar and commons-logging.jar (not
> commons-logging-api.jar!!!!!!!!!!!) are in common/lib
> 
> 4.  Make sure you have log4j.properties in both common/classes and
> WEB-INF/classes.  You might even want to switch to using a log4j.xml config
> file for your webapp just to be sure that you aren't picking another log4j.xml
> file improperly distributed in a jar file.
> 
> If you do all the above, logging should work as you expect.  Note that for
> ServletContext.log() statements to go to context-specific files, you will still
> have to define the loggers as detailed in the example log4j.properties that I
> sent in my previous email.

It's a bit tricky sometimes. For example, getting the container logger
a bit too early, when the context CL isn't set to the webapp CL (it
doesn't exist yet) can get you a logger based on the main
configuration. That's an issue with the current CVS code, but I think
it should be ok with the version used here (although it's tough to be
100% sure).

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

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


Mime
View raw message