jmx - Does logback's shutdownHook unregister the jmxConfigurator -
i making use of <jmxconfigurator/> element in logback; jmxconfigurator states following:
thus, unless application standalone java application, **must** unregister jmxconfigurator instance jvm's mbeans server. the logback documentation mentions <shutdownhook/> configuration element according documentation following:
installing jvm shutdown hook convenient way shutting down logback , releasing associated resources. does including <shutdownhook/> element take care of unregistering <jmxconfigurator/>?
yes, does. here proof debugger: 
however, there few restrictions:
<shutdownhook/>available of version 1.1.3- although the documentation says plain
<shutdownhook/>enough, have specifyclassproperty:<shutdownhook class="ch.qos.logback.core.hook.delayingshutdownhook"/>otherwise logback complains with:error in ch.qos.logback.core.joran.action.shutdownhookaction - missing class name shutdown hook. near [shutdownhook] line 16
to make sure jmxconfigurator gets stopped enable debug mode on logback configuration:
<configuration debug="true"> ... </configuration> then @ end of logs you'll see:
info in ch.qos.logback.core.hook.delayingshutdownhook@1a246fc6 - logback context being closed via shutdown hook info in ch.qos.logback.classic.jmx.jmxconfigurator(default) - onreset() method called jmxactivator [ch.qos.logback.classic:name=default,type=ch.qos.logback.classic.jmx.jmxconfigurator]
Comments
Post a Comment