title: How to remove or replace newline from log messages log4j
body: <p>I am using below conversion pattern</p>
  
  <pre><code>log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS Z}  [%t] %-5p %c- %m%n
  </code></pre>
  
  <p>but I want to remove new line characters. </p>
  
  <p>I have tried using <code>%replace(%ex){'[\r\n]+', '\\n'}%nopex%n</code></p>
  
  <p>but it's not working %replace is not working. it only reading <strong>%r</strong> and then <strong>eplace</strong></p>