Hi,

Does anybody have a wonderful idea in creating a log file when a request was
send to the server?

Here is the an example code that I did (Simplified)

main program

public class MainProgram(){
   :
   Logger.startLog();
   :
}

public class Logger() {
   private Logger(){
      ;
   }
   public void startLog(){
      WriteToFile wtf = new WrtiteToFile(); //in class that extends Thread
      wtf.run();
      wtf = null;
   }
   public class WriteToFile extends Threads(){
      public void run() {
      try {
            String query = "request time: "+ new Date();
            writeLog(); //method that will write to a file
      }
      catch (Exception e) {
            System.out.println("Error: "+e);
      }
}

I did this logic to avoid blocking in the MainProgram(). But the Logger()
instance does not removed and keeps on filling up every time the
MainProgram() executes which takes a log of resources. So if I call the
MainProgram 10 times, it will also create 10 intance of Logger().

Hope I presented my problem clearly. Thanks


/Renz

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to