tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Pimley <>
Subject Re: Undeploying problem with Tomcat 5.5 and Log4J
Date Wed, 03 Jan 2007 20:56:47 GMT
Caldarale, Charles R wrote:
> Please don't use finalize() if you can possibly avoid it - it really
> bogs down the internal workings of the JVM.
Hello.  I'm new here :)

I don't think you're even guaranteed that finalize will be called at all 
are you?

It's interesting to note that objects (and so 
FileOutputStreams and, indirectly, FileWriters) call close within their 
finalize method.  This means that nine times out of ten you can happily 
forget about them without bothering to call close, and eventually either 
they get finalized and closed, or your entire application exits anyway.

You can get in trouble when the JVM does not exit when you're 
"finished".  Could it be possible that within log4j there's a 
FileOutputStream with your log file open that has not been finalized 
yet?  IIRC, Log4j keeps secret handles to Logger instances in order to 
give you the same Logger on duplicate calls to getLogger().

If I were in your position I'd have a good look through the log4j 
documentation and try and find ways of explicitly shutting down the 
entire system.

Maybe this is what you're after:

(disclaimer: It's been about a year while since I looked at anything in 
that sort of area!)

Peter Pimley

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message