title: Can a stack trace exception be added to SLF4J LOGGER?
body: <p>Here's SSCCE adding SLF4J LOGGER messages and throwing a null pointer exception. It uses a list appender to examine the log:</p>
  <pre><code>package my.tester;
  
  import org.junit.jupiter.api.Assertions;
  import org.slf4j.LoggerFactory;
  
  import ch.qos.logback.classic.Logger;
  import ch.qos.logback.classic.spi.ILoggingEvent;
  import ch.qos.logback.core.read.ListAppender;
  
  public class TestException {
  
      public static void main(String[] args) {
  
          final Logger LOGGER = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(&quot;TestException&quot;);
  
          final ListAppender&lt;ILoggingEvent&gt; listAppender = new ListAppender&lt;&gt;();
          listAppender.start();
          LOGGER.addAppender(listAppender);
  
          NullPointerException testException =  new NullPointerException(&quot;Oops!&quot;);
  
          LOGGER.info(&quot;doing stuff&quot;);
          LOGGER.error(&quot;problem here&quot;, testException);
  
          Assertions.assertTrue(listAppender.list.get(1).getFormattedMessage().contains(&quot;Oops&quot;));
  
      }
  }
  </code></pre>
  <p>There are only 2 lines in the log appender:</p>
  <pre><code>doing stuff
  problem here
  </code></pre>
  <p>so naturally, the test to check for the exception fails with the following output:</p>
  <pre><code>16:45:15.577 [main] INFO TestException - doing stuff
  16:45:15.591 [main] ERROR TestException - problem here
  java.lang.NullPointerException: Oops!
      at my.texter.TestException.main(TestException.java:34)
  
  Exception in thread &quot;main&quot; org.opentest4j.AssertionFailedError: expected: &lt;true&gt; but was: &lt;false&gt;
      at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
      at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:40)
      at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:35)
      at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:162)
      at my.texter.TestException.main(TestException.java:39)
  </code></pre>
  <p>How can the stack trace from the null exception be added to the log?</p>