title: Spring's @PreDestroy results in logging randomly not logging
body: <p>I'm using Spring, and on termination I'm having @PreDestroy clean up beans. I don't understand why logging randomly succeeds sometimes, and fails on others.</p>
  
  <pre><code>// Using Log4j2
  Logger log = LogManager.getLogger(MyClass.class);
  
  @PreDestroy
  public void close() {
      log.warn("Test");
  }
  </code></pre>
  
  <p>Sometimes I will get nothing (no "Test" is logged), other times I will get:</p>
  
  <pre><code>[13:48:44] INFO  MyClass: Test
  </code></pre>
  
  <p>If I include <code>System.out.println("Is this run?");</code> in the close() method, it will always print.</p>
  
  <p>I'm not actually sure what is happening. I don't know if it's because the JVM is shutting down and the logger is killed... but I thought that would throw some kind of exception?</p>
  
  <p>Note that the logging logs both to a file + stdout, I don't know if that would affect anything. Logging works fine for the other countless thousands of lines of code, but not this.</p>
  
  <p>NOTE: I am open to switching logging libraries if it ends up being this particular library.</p>
  
  <p>EDIT: MyClass would be a bean in a spring.xml document.</p>