hi trenton,

if u have some fancy IDE like Visual Age/Visual Cafe' u can debug
applications at runtime...but sadly the vast majority of us cannot afford
such tools..so we print to the console...however my box is win98 and the
console window does not scroll beyond 50 lines..so i wrote a simple log
file.. and i pipe the output to the file.....in a production environment u
can then parse this logfile for errors,excptions etc using any regexp
package or perl scripts..i have found it very useful..here is the code

import java.io.*;

public class LogFile {

    /** Creates new LogFile */
    public LogFile() {}

    public static void log(String str) {

        try {
            File f = new File("C:/wclog.txt");

            f.createNewFile();

            RandomAccessFile out = new RandomAccessFile(f, "rw");

            out.seek(out.length());
            out.writeUTF("\n");
            out.writeUTF(str);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

import this file in ur servlet/JSP and use LogFile.log("<ur commenrts
etc>")....

hope this is useful..

ravi

----- Original Message -----
From: "RNivas" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 10:29 AM
Subject: Re: Debugging


> usually I do work to get the out put on tomcat console(some time) most of
> the instances I take output on browser screen.
>
> Wishes
>
> ----- Original Message -----
> From: "Trenton D. Adams" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
> Sent: Wednesday, June 12, 2002 10:42 PM
> Subject: Debugging
>
>
> > Where could I get information on debugging a web application under
> > tomcat?  Is there a way of doing it or do you have to just do a whole
> > bunch of printing to the tomcat screen or web page?
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to