tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amandeep Jawa" <d...@imagelock.com>
Subject What is the best way to redirect System.out in my servlets running under Tomcat?
Date Mon, 25 Sep 2000 22:01:48 GMT
Ok - so I know that there are partial answers to this question in the FAQ -
but I'd like a definitive one (& hopefully a better one) & then I'll add it
to the FAQ.....  ALos most of the answers in the FAQ refer to JServ - not
Tomcat......

What is the best way to redirect System.out in my servlets running under
Tomcat?  I'd like to get the std out messages into a log file.

After searching the FAQ & the mailing list archive I tried numerous things -
but the only one that worked was the invasive 2 step process of:

1) redirecting stdout from my tomcat launch script:
$TOMCAT_HOME/bin/startup.sh >tomcat.log 2>tomcat.err

2) Early in my servlet source setting System.out to the same as System.err
    if(System.err != System.out)
        System.setOut(System.err);

I REALLY don't like this method because a) I have to change code, b) it
seems that now I've reconfigured the JVM & thus other java apps will have
stderr = stdout & c) there is no really good place in my code to call
System.setOut(System.err);


Does anyone have a better solution?



--------------------------
Amandeep Jawa
Imagelock, Inc.
--------------------------
deep@imagelock.com
1725 Montgomery St
San Francisco CA 94111

Work: 415 616 7262 (616 SAMBA)
Fax: 415 392 5382

http://www.imagelock.com




Mime
View raw message