views:

980

answers:

2

Where does tomcat puts the System.out.println output ?

i'm not interested in OUT.println, i'm using a system that use system.out to log issues, like login sucess/fail, and i need to look to that generated "log".

tnx!!

A: 

*CATALINA_HOME*/logs/stdout_YYYYMMDD.log

is the default, where *CATALINA_HOME* is your base Tomcat directory. There are various ways to change this programatically and via configuration.

rcampbell
$ ls /usr/local/tomcat/logsadmin.2009-10-06.log catalina.2009-10-06.log catalina.out host-manager.2009-10-06.log localhost.2009-10-06.log manager.2009-10-06.log tomcat.login none of this files i notice any change with a system.out.println, where should this configuration be ?tnx!
Fusion
What version of Tomcat are you running?
rcampbell
i'm running tomcat 5.5
Fusion
+1  A: 

It usually prints to catalina.out.

It is highly unrecommended to log using system.out.println() from several reasons:

  • you cannot control which messages are logged and which aren't unless you change the code
  • catalina.out just grow all the time, and you cannot move it so that tomcat will create another one.

A better solution is to use one of the popular (and mature) logging frameworks:

A good solution which is backed by log4j, is to use Jakarta's log tag library, where you can have your logging messages in any of this forms

<log:info message="this is a message"/>

<log:info category="foo.bar" message="this is a message"/>

<log:info category="foo.bar">
  this is a message
</log:description>
David Rabinowitz