Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Do you have swallowOutput set to true on your contexts? "If the value of this flag is true, the bytes output to System.out and System.err by the web application will be redirected to the web application logger. If not specified, the default value of the flag is false." – Brian Deterling Jan 4 '11 at 19:09

I found the following information, guess this should help you.

Try this,

  1. Each application must use its own log4j. You can achieve this by placing log4j.jar in WEB-INF/lib of each application.
  2. In each log4j's configuration file (default location is WEB-INF/classes), specify the log file name, e.g. log4j.appender.AppLog.File=${catalina.home}/logs/app1.log.
  3. Add 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,


share|improve this answer

stdout points to catalina.out in the 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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.