[logback-user] Separate stacktrace from others logs
Matthieu Nantern
matthieu.nantern at gmail.com
Tue Dec 29 09:46:46 UTC 2015
Hello !
I'd like to separate my stacktrace from other logs in 2 different files. I
manage to do that with 2 appenders:
The first one with %nopex:
<encoder>
<charset>UTF-8</charset>
<pattern>%nopex %d{dd/MM/yyyy-HH:mm:ss.SSS}
[%thread][%X{TRANSACTION_ID}] %-5level %logger{36}:%L - %msg%n</pattern>
</encoder>
The second with only %xException{full}
But now I want to add my MDC field TRANSACTION_ID when an exception arises
(and only when an exception pop up). Just adding %X{TRANSACTION_ID} to my
pattern doesn't work, I have a new line for every log line even when I
don't have any exception.
Do you have any idea of how to do it ?
Thank you !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20151229/ee9fae8a/attachment.html>
More information about the logback-user
mailing list