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: enter image description here

however, there few restrictions:

  1. <shutdownhook/> available of version 1.1.3
  2. although the documentation says plain <shutdownhook/> enough, have specify class property: <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

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -