You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Don Elliott <do...@key-signature.com> on 2001/01/23 13:42:39 UTC

Capturing stderr to a file

Hi Struts Users,

I've just installed a Tomcat / struts / JDBC application (standalone Tomcat on NT 4) and am working my way through porting it to talk to Oracle (original sample was PostgreSQL)..

I've got it talking to the database OK, however the port has caused lots of type casting problems (it appears all my data gets returned as String from Oracle, however the original code seemed to get it back correctly).

My biggest problem in finding these problems is that Tomcat is dumping STDERR to the terminal which scrolls away irretrievably, and I can't seem to get it to re-direct anywhere else - I've tried '2>filename' within tomcat.bat on the start command and have also tried setting it in the tomcat.properties and wrapper.properties files (changes in both these files seem ineffective).

Any ideas ?

Regards,
Don Elliott
don@key-signature.com



Re: Capturing stderr to a file

Posted by Peter Alfors <pe...@irista.com>.
You could catch the error and retrieve the stacktrace from it:

              StringWriter writer = new StringWriter();
              myException.printStackTrace( new PrintWriter( writer ) );
              stackTrace = writer.toString();

Then write it to a file.

HTH,
    Pete