You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Ilja S." <il...@frontdesk.ee> on 2007/06/13 13:46:25 UTC

tomcat 5.5 stdout

Hi
It seems there is a lot of confusion around new tomcat 5.5 internal 
logging. I also have a question:
Is there a way to separate stdout (which is all by default written to 
one file catalina.out) to be in files by virtual hosts / context. i.e. 
each application could have its own file where stack trace / uncaught 
exceptions / System.out written? Using either JULI or Log4j logging?
If there are many applications running and all writing exceptions to one 
  file this might become a nightmare to debug. (Yes yes I know that each 
application should use Log4j or similar, but it is not always like that 
+ those uncaught exceptions you know...)
Thanks in advance.
-- 
*************************************
Best Regards
Ilja


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


Re: tomcat 5.5 stdout

Posted by Gregor Schneider <rc...@googlemail.com>.
hi illja,

On 6/13/07, Ilja S. <il...@frontdesk.ee> wrote:
> Thanks a lot for quick reply!
> To conclude:
> 1. stdout can NOT be redirected to multiple files and can be only in one
> file (usually catalina.out)
>
that's right.
the only workaround is to use jsvc
(http://tomcat.apache.org/tomcat-5.0-doc/setup.html).
with this you can run tomcat either as a service in windows or as a
demon in unix / linux, and you can redirect stdout / stderr to a file
specified in the start-script.
however, it will still be ONE file each for stout / stderr, meaning
you cannot destinguish between the output of different web-apps
>
> 2. All uncaught exceptions / System.out from ALL applications are going
> to this one file. And we can not do anything about this.
>
> Right?
>
right

Therefore.

Use a logger and make ensure clean programming of your applications
avoiding System.out / err. Also handle exceptions using the logger
(Logger.err ("Your warning", exception).

Cheers

Gregor
-- 
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

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


Re: tomcat 5.5 stdout

Posted by "Ilja S." <il...@frontdesk.ee>.
Thanks a lot for quick reply!
To conclude:
1. stdout can NOT be redirected to multiple files and can be only in one 
file (usually catalina.out)
2. All uncaught exceptions / System.out from ALL applications are going 
to this one file. And we can not do anything about this.

Right?

*************************************
Best Regards
Ilja


Gregor Schneider wrote:
> One option is to use log4j (http://logging.apache.org/log4j).
> you can specify loggers for each application writing to pre-defined 
> locations.
> 
> however, you will also have to maintain some disciplin, since log4j or
> the java-logging-api are not able to redirect stdout. That means: Do
> not use System.out / System.err but use your preferred logger instead.
> 
> Unfortunately, some central applications (like commons.pool f.e.) do
> not care about any loggers but just dump their output to System.out.
> 
> You could specify in $catalina_home/commons/classes/log4j.xml a logger
> based on the classnames that produces the output, however, if those
> central components just use System.out/err instead of logging, you
> will have to live with this.
> 
> Anyways, moving your applications to log4j / [enter your preferred
> logging-api here] is a great step into the right direction, esp. if
> you want to destinguish between error-weight of the message and the
> source where this message came from.
> 
> Cheers
> 
> Gregor


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


Re: tomcat 5.5 stdout

Posted by Gregor Schneider <rc...@googlemail.com>.
One option is to use log4j (http://logging.apache.org/log4j).
you can specify loggers for each application writing to pre-defined locations.

however, you will also have to maintain some disciplin, since log4j or
the java-logging-api are not able to redirect stdout. That means: Do
not use System.out / System.err but use your preferred logger instead.

Unfortunately, some central applications (like commons.pool f.e.) do
not care about any loggers but just dump their output to System.out.

You could specify in $catalina_home/commons/classes/log4j.xml a logger
based on the classnames that produces the output, however, if those
central components just use System.out/err instead of logging, you
will have to live with this.

Anyways, moving your applications to log4j / [enter your preferred
logging-api here] is a great step into the right direction, esp. if
you want to destinguish between error-weight of the message and the
source where this message came from.

Cheers

Gregor
-- 
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

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