In my project, I am using Logback as logging facility. I have the following class
@Component
class Test {
@PreDestroy
public void destroy() {
try
There is a documented way to disable to disable the registering of the LogbackServletContextListener
:
You may disable the automatic the installation of LogbackServletContextListener by setting a named logbackDisableServletContainerInitializer in your web-application's web.xml file. Here is the relevant snippet.
.... logbackDisableServletContainerInitializer true Note that logbackDisableServletContainerInitializer variable can also be set as a Java system property an OS environment variable. The most local setting has priority, i.e. web-app first, system property second and OS environment last.
I would imagine you'll probably want to write your own shutdown hook if this is the case and stop the LoggerContext