tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Trying to filter noise from catalina.out.
Date Wed, 05 Nov 2014 14:50:43 GMT
Hash: SHA256


On 11/5/14 7:31 AM, Daniel Mikusa wrote:
> On Tue, Nov 4, 2014 at 6:12 PM, Brandon Darbro
> <> wrote:
>> Looking for configuration help.
>> Using tomcat7 7.0.34 from rpm package
>> tomcat7-7.0.34-3.jpp6.noarch.
>> Followed the instructions for using log4j for catalina.out found
>> here: 
> These are instructions for using Log4j with Tomcat.  It would
> enable you to control the files that Tomcat creates with log
> content.  This includes files like catalina.yyyy-mm-dd.log,
> localhost.yyyy-mm-dd.log and other files that by default have the
> date in their name, however it does not allow you to control
> catalina.out.

Yes and no. You can't control things like file rotation using log4j,
but you can affect some of the logging that ends up going to the console.

You need to make sure that all logs are being either filtered
completely (like or directed to
a different appender (aka log destination) by doing[level],APPENDER where
APPENDER is the log destination where the logs should flow.

I believe by default that a log of things go to the console, and thus
into catalina.out.

> The catalina.out file represents anything written to STDOUT or
> STDERR by Tomcat or your applications.  This would include things
> like an application directly writing to System.out or System.err or
> an application that is configured to log to STDOUT / STDERR or as
> some logging framework's call it the console.
> If you have application's writing to STDOUT / STDERR directly, you
> can use Tomcat's "swallowOutput" option to capture this output and
> run it through the logging system.
> If you have applications that are logging to STDOUT / STDERR, you
> can control what's logged by editing the application specific
> logging configuration or by instructing them to log to a file and

Well, yes, but the better solution is to stop using System.out and
System.err and instead use a proper logger. Using commons-logging
works great.

If replacing System.(out|err) represents a big job, then you can cheat
a bit and put swallowOutput="true" in your <Context> element to
redirect these streams to the application logger (which must be
properly configured). Then all that noise won't go to catalina.out.

> For the record, Tomcat writes very little to STDOUT / STDERR and it
> doesn't use EHCache so it's almost certain that the exception
> you're seeing is coming from an application.

Tomcat's current trunk has exactly 64 System.(out|err).print
statements (which actually might be move than necessary) and those are
usually printed in cases of sever problems (like OutOfMemoryError,
where you can't rely on the logging system to work properly). Most of
the drivel that is written to catalina.out can be filtered or written
to other logs by changing the defaults. Anything coming from the
application should be the responsibility of the application author.

- -chris
Version: GnuPG v1
Comment: GPGTools -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message