×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi Chad,
One of the ways of doing that can be to set System.out and System.err to a new 
PrintStream of any file in IFS as following:

        // redirect standard out
        String fname = "/jakarta-tomcat-4.1.27/logs/your_out_log.txt";
        File f = new File(fname);
      PrintStream printStream = new PrintStream(new BufferedOutputStream(new 
FileOutputStream(f)), true);
      System.setOut(printStream);
      System.out.println("Log started: " + new java.util.Date());

      // redirect error out
      fname = "/jakarta-tomcat-4.1.27/logs/your_err_log.txt";
      f = new File(fname);
      printStream = new PrintStream(new BufferedOutputStream(new 
FileOutputStream(f)), true);
      System.setErr(printStream);
      System.err.println("Error Log started: " + new java.util.Date());

You can do it in any servlet init method and specify in your webapp web.xml to 
load this servlet on a startup as following:
<servlet>      
   <servlet-name>
      com.aero.login.Login
   </servlet-name>
   <servlet-class>
      com.aero.login.Login
   </servlet-class>
   <load-on-startup>1</load-on-startup>
</servlet>

Alex Pinsky
Aeropostale, Inc.



-----Original Message-----
From: cornelius, chad [mailto:chad.cornelius@xxxxxxxxxxxxxxxxxxxx]
Sent: Friday, January 16, 2004 12:28 PM
To: 'JAVA400-L@xxxxxxxxxxxx'
Subject: Direct debug statements to text file rather spooled file using
Tomcat


Does anyone know how to direct debug statements/System.outs to a text file
using Tomcat?

 

Thanks,

Chad

 

_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.