I have written a Log class that logs errors in a file as they happen in my
servlet.
In the servlet's init() method, i put this code:
  String logfile = propr.getProperty("logfile", "errors.log");
  log = new Log(logfile);

In the log class, the constructor begins with:
  public Log(String fichierLog)
  {
    try
    {
      log = new PrintWriter(new FileWriter(logfile, true), true);
      write("Log started.");
      opened = true;
      ...

I wrote a finalize() method for the Log class in order to write a last
message:
  protected void finalize()
  {
    if(opened == true)
    {
      write("Log stopped.");
      log.close();
    }
  }

The problem is, i never get the message "Log stopped.", even if i close the
browser
that initiated the request and even if i stop the web server (i'm working
with
Apache 1.3.6/JServ1.0b3 under Win NT4 and i stop it thru the Services
control panel).

guillaume

___________________________________________________________________________
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