Hi,

I registered a shutdownhook in my code and found that there is no any log 
output from my hook method, the reason is that since log4j2.1, shutdown hook 
registry will be enabled by default from log4j, logger is stopped by log4j's 
hook before my hook is invoked.

Of course I can disable the hook from log4j by 
"-Dlog4j.shutdownHookEnabled=false", but I think it might be better to keep it, 
so I wonder if there is way to ensure my hook is invoked before log4j's hook.

And if there is no that way, is there any programmatic way to disable the 
log4j's shutdownhook rather than JVM parameter.

Thanks in advance.

Best regards.

Reply via email to