Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logback print full MDC in appender

Tags:

java

logback

mdc

In an appender in a logback.xml is it possible to do any operation like iterating over an MDC, printing the entire MDC, etc.? The easiest way I can think to do this is basically via java/groovy code (which I haven't researched how to do yet), was wondering if there's a shorthand.

like image 460
djechlin Avatar asked Dec 06 '12 17:12

djechlin


1 Answers

If you are using the patternlayout using %mdc should work. E.g:

"%d [%thread] %-5level %logger{36} - %msg %mdc%n"

like image 135
Knut Saua Mathiesen Avatar answered Oct 03 '22 15:10

Knut Saua Mathiesen