
29 Dec
2015
29 Dec
'15
9:46 a.m.
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 !