Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.
The "HowTo" page has been changed by KonstantinKolinko: http://wiki.apache.org/tomcat/HowTo?action=diff&rev1=128&rev2=129 Comment: Add "try" and "finally" PrintStream oStdOutBackup = System.out; PrintStream oStdErrBackup = System.err; + try { + - // Redired STDOUT and STDERR to the ServletOuputStream + // Redired STDOUT and STDERR to the ServletOutputStream - System.setOut(new PrintStream(out)); + System.setOut(new PrintStream(out)); - System.setErr(new PrintStream(out)); + System.setErr(new PrintStream(out)); - - try + try { - { // ... call compiler here that produces // tons of STDOUT/STDERR messages ... + } catch(Exception e) { + out.println(e); + } + + } finally { + + // Restore original STDOUT and STDERR + System.setOut(oStdOutBackup); + System.setErr(oStdErrBackup); + } - catch(Exception e) - { - out.println(e); - } - - // Restore original STDOUT and STDERR - System.setOut(oStdOutBackup); - System.setErr(oStdErrBackup); out.println("<hr />"); out.println("</body>"); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org