Hi,
I have an application-wide log4j.properties which logs to stdout, with
the config like:
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
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=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=5
log4j.appender.R.layout=org.apache.log4j.PatternLayout
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: [email protected]
For additional commands, e-mail: [email protected]