I'm trying to remove newline from Java stacktraces.
I've following logback pattern -
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %replace(%msg){'\n', ''}%n</pattern>
I expect it to replace newlines in messages but it is not doing so. I see stacktraces printed out with newlines.
However, if I use following pattern (for testing purpose only)-
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %replace(%msg){'.*', 'x'}%n</pattern>
I find that messages are getting replaced with character x but stack traces are still getting printed as is.
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).
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?