logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olexandr Prokhorenko <olexa...@prokhorenko.us>
Subject log4j logging to stdout and server-wide override
Date Fri, 10 Apr 2009 20:30:58 GMT

I have an application-wide log4j.properties which logs to stdout, with  
the config like:

log4j.rootLogger=WARN, stdout

It sends all mess to catalina.out.  However, I want to use log4j for  
Tomcat 5.5 logging now.  So I configured Tomcat to write WARN to  
tomcat.log and eventually I'll want to receive ERROR by email  
(org.apache.log4j.net.SMTPAppender or just different file work work  
just fine for me).  Here's what I've got for conf/log4j.properties (or  
common/classes/log4j.properties, as I basically have a symlink).

log4j.rootLogger=WARN, R
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

log4j.logger.org.apache.catalina.core=WARN, R
log4j.logger.org.apache.catalina.session=WARN, R

However, it comes that because of my application(s) write directly to  
stdout they don't happen to appear in my server-wide log4j output,  
their messages still go to catalina.out.  I changed conf/context.xml  
to include swallowOutput, but it doesn't seem to be working (at least  
not for my stuff):

<Context swallowOutput="true" />

My application(s) still write to catalina.out.  What is the best way  
to make it do what I want?  Thank you.

P.S. I have more then 20 wars built with log4j.properties which write  
to stdout, so changing this piece is pretty unwelcome. ;)  I'd be  
happy to find some server-wide override tool instead.  Sometimes I  
don't even know does the application have an explicit stdout output or  
not.  Thank you.

--Alexander Prohorenko.

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

View raw message