title: How do I remove newline from Java stacktraces in logback?
body: <p>I'm trying to remove newline from Java stacktraces. </p>
  
  <p>I've following logback pattern - </p>
  
  <pre><code>&lt;pattern&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %replace(%msg){'\n', ''}%n&lt;/pattern&gt;
  </code></pre>
  
  <p>I expect it to replace newlines in messages but it is not doing so. I see stacktraces printed out with newlines. </p>
  
  <p>However, if I use following pattern (for testing purpose only)- </p>
  
  <pre><code>&lt;pattern&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %replace(%msg){'.*', 'x'}%n&lt;/pattern&gt;
  </code></pre>
  
  <p>I find that messages are getting replaced with character x but stack traces are still getting printed as is. </p>
  
  <p>This makes me believe that logback treats stacktraces indepdentantly.
  I've gone through the logback documentation it says that one can refer to stacktraes via (%ex). </p>
  
  <p>But then, I can have only one pattern active at a time for the appender. 
  How do I go about making sure that I don't get newline in stacktraces?</p>