How to configure tomcat 5.5 (or 6.0) that the output of stdout and stderr of each web application / context will go to one logfile?
I only managed to get the stderr to a specific logfile - the stdout of the applications still went to catalina.out.
How to configure tomcat 5.5 (or 6.0) that the output of stdout and stderr of each web application / context will go to one logfile?
I only managed to get the stderr to a specific logfile - the stdout of the applications still went to catalina.out.
I found the following information, guess this should help you.
Try this,
log4j.jar
in WEB-INF/lib
of each application.WEB-INF/classes
), specify the log file name, e.g. log4j.appender.AppLog.File=${catalina.home}/logs/app1.log
.swallowOutput="true"
for each context so stdout, stderr will go to your own log.We do this on Tomcat 5.5 but I think it should work on 6.0 also.
EDIT: Here is our META-INF/context.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<Context override="true" swallowOutput="true" useNaming="false">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager pathname=""/>
</Context>
stdout points to catalina.out in the catalina.sh
script, this applies for the Tomcat server as a whole.
"$CATALINA_BASE"/logs/catalina.out 2>&1 &
I know this is not a complete answer - just telling you where to look.
Another method to separate the output would be to run one tomcat instance for each webapp. This way you can not only separate the webapp logs, but also the other log files, the JVM parameters, start and stop of the instances and so on.
You'll find a step by step guide here.