[logback-user] How to release appender resources on application end/undeployment
jvm.pointer
jvm.pointer at o2.pl
Fri Dec 14 10:40:34 CET 2012
Hi,
I`m writing an appender that sends log messages to RabbitMQ.
The appender extends ch.qos.logback.core.AppenderBase<ILoggingEvent>, obtains connection to RabbitMQ in start() method, sends a message to RabbitMQ in append(ILoggingEvent event) and releases that connection in the stop() method.
The sending part works well but I`ve a problem with logback not calling appenders` stop() method when all desktop application` threads end or when the web app is undeployed.
I don`t know if it`s a bug or (more probably) I`m missing something but the end result is that the stop() method is not being called, so the connection to RabbitMQ is not released and the desktop application never terminates and web applications cause memory leaks because of that hanging connection.
For example tomcat reports the following:
org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/context_name] appears to have started a thread named [AMQP Connection 127.0.0.1:5672] but has failed to stop it. This is very likely to create a memory leak.
I'll be grateful for any suggestions and tips on how to release appender resources on application end / undeployment.
If it`s not my wrong assumption that logback should call stop() method to stop/deregister the appender I`ll fill in a JIRA issue.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20121214/8057a9aa/attachment.html>
More information about the Logback-user
mailing list