> From: Nick Williams [mailto:nicho...@nicholaswilliams.net] > Subject: Re: LOG4J2-223: IllegalStateException thrown during Tomcat shutdown > (memory leak, it looks like)
> Log4j 1 never required a listener to be configured to be shut down > properly when an application is undeployed. What bearing does that have on a different logging mechanism? > It should be possible to do this without a listener. Not easily. > Could a `finalize` method be used instead of a shutdown hook/listener? Finalizers should be avoided like the plague. The gyrations the JVM has to go through to handle them result in continual run time impacts, and require at least two GC passes to actually get rid of the objects. > What I don't know is if it is guaranteed to be called in non-web applications > when the JVM just shuts down. Finalizers are not called at JVM termination, since the process exit is expected to release resources automatically. You cannot actually count on a finalizer ever being invoked; it's one of those "seemed like a good idea at the time" things that is now widely regretted by JVM implementers. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org