I've had that before, but not sure why it happens.  Perhaps a garbage
collection issue???

You probably want to look at the System.runFinalizersOnExit(), or
System.runFinalization().  The
first will force the finalize methods of unreferenced objects when the program
exits.  The second
will force the finalize methods of whatever currently unreferenced objects are
hanging around
waiting to be, err, trashed.

The JDK1.1 has these static methods in both the Runtime and System classes.
It appears that the
System finalizer methods are simply wrappers for the Runtime methods.

guillaume ORIOL wrote:

> 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

___________________________________________________________________________
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