tomcat-users mailing list archives

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

Daniel,

On 11/5/14 7:31 AM, Daniel Mikusa wrote:
> On Tue, Nov 4, 2014 at 6:12 PM, Brandon Darbro
> <bdarbro@uievolution.com> 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: 
>> http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Using_Log4j
> 
> 
> 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
logger.com.fakename.services.cache.ehcache.level=ERROR) or directed to
a different appender (aka log destination) by doing
logger.com.fakename.services.cache.ehcache=[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.
> 
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
> 
> 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
> not STDOUT / STDERR.

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUWjlDAAoJEBzwKT+lPKRY8a8QAMJqVxay4h3Lml3p1v1SnaGf
y6VQ1MeEj9NsOjEn9grImnCuL8cA6A6/BYALXmDGP+Tso/rw0Id98SAKtAelwDq1
zr8WmAIrOtyrE2UgGV8L7WvWTtJs+K9YZdZF+ChQNAfuQAFnnVxieH9uW7QepCQs
9dSp1mjyj8J/NGxTc01T/7l3E2DFoCJ8Z1wqUUa+HURyn3EXd8VW/b9Bxslvw99K
e1FN+IksjZDYGrxjf1Ofom2XsPb42Wy76OJffqCTbCYuui2bM1O7BFnbH/001MAc
Qt8hFUiLf70SjKH0tF2EOT1ZXRNr2PKNqckkJooUfroMq27pnTnVfsMrBsAcJBr2
ZxywqSWc2b0iQuXm85eDlTVoYg6L61DhvHnsQhhclJEvw5c4pUTA5fguuw1hQ4Qg
Ga9P5UbkWOtrrlMS6Ofa6wQkPf8uKDExHmAC4lxta6IUAD8DTlypn1TDlzgh/QZc
v9BzUuNF0WuqYpQ2u+PpcomQAKY9l9KG2B0nlMZKR2F5saDF/Johm036v4fj24Sp
AuzW3gHKyCqVcKtOkwH/s8SvFrzsW7Tf66qe0fnWpAUtmsFD2YntoTE6hDerHPvE
eau0gKRhXOhOmEwMLEVwrFrb3YCFNaQzbHl0NihoC2TpbesaxPaA9zdEsHY3FLHs
/wJmuNKZop71DAt3oo0e
=KhTg
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message