title: Slf4j/logback - print stacktrace in separate file
body: <p>I'm setting up a project with slf4j backed by logback. I log exceptions at the root of my program with</p>
  
  <pre><code>logger.error(ex.getMessage(), ex);
  </code></pre>
  
  <p>I've got logback configured like so (minus unimportant stuff)</p>
  
  <pre><code>&lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt;
      &lt;file&gt;app.log&lt;/file&gt;
      &lt;encoder&gt;
          &lt;pattern&gt;${details}: %msg%n&lt;/pattern&gt;
      &lt;/encoder&gt;
  &lt;/appender&gt;
  
  &lt;root&gt;
      &lt;appender-ref ref="FILE"/&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The important bits are working fine. My problem is that despite %ex not being included in my pattern, stacktraces get printed anyway, as regular sysout-like lines, after the error message.</p>
  
  <p><code>00:23:50.713 ERROR blabla: something happened
  java.lang.RuntimeException: something happened
      at ...
      at ...
  </code></p>
  
  <p>Since I want my log to be easily parsable, that stacktrace is in my way (it doesn't fit into my line format) and I don't want it there. I want stacktraces to go to a separate file, printed as</p>
  
  <pre><code>&lt;file&gt;stacktrace.log&lt;/file&gt;
  &lt;encoder&gt;
      &lt;pattern&gt;${details}: %ex%n&lt;/pattern&gt;
  &lt;/encoder&gt;
  </code></pre>
  
  <p>I'd assume something this obvious isn't a bug in logback where stacktraces oopsie their way into the output despite being absent in the pattern. I've been going over the documentation but I can't seem to find a way to get what I want: to print stacktraces only in a dedicated stacktrace log. Can it be done?</p>