logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juha Laiho <Juha.La...@iki.fi>
Subject Re: Seperate log files for Tomcat / Java errors and application info
Date Mon, 12 Jun 2006 16:17:28 GMT
Robert Bowen wrote:
> I have been scouring the list and have found a few mentions of how to maintain two seperate
log files but I can't find examples and in any case what I would like to do is something a
little different although I'm sure easy to do.
> 
> My app spits out all kinds of info in a certain, precise format. Tomcat startup/shutdown
and Java exceptions are sneaking into my log. I would like tobe able to have all non-app messages
go to one log, and app messages to another.

So, you've placed log4j jar somewhere where Tomcat itself finds it (and 
as Tomcat uses Jakarta commons-logging, the commons-logging configures 
itself to use log4j whenever it finds log4j classes on the classpath).

Two solutions:
- move log4j jar somewhere where it doesn't end up in Tomcat framework
   classpaths, but only in webapp classpaths
   see: http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
- if you don't use commons-logging in your own code, configure
   commons-logging to use some other logging implementation than log4j
   see: 
http://jakarta.apache.org/commons/logging/commons-logging-1.0.2/docs/api/org/apache/commons/logging/package-summary.html

For the first, you could move log4j jar out of the classpath, somewhere 
where it is found by the shared classloader.

For the second, you need to add a system property 
org.apache.commons.logging.Log to Tomcat startup with the value 
specifying your desired Tomcat logging implementation.

-- 
..Juha

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


Mime
View raw message