code: private void allowCleanShutdown() {
          DelayingShutdownHook hook = new DelayingShutdownHook();
          Context context = (Context) this.loggerFactory;
          hook.setContext(context);
          Thread hookThread = new Thread(hook, "Logback shutdown hook [" + context.getName() + "]");
          Runtime.getRuntime().addShutdownHook(hookThread);
      }
docs: see https://jira.qos.ch/browse/LOGBACK-1162