java - How can I add my own parameters in logback pattern configuration? -
i have logback configuration:
<encoder class="ch.qos.logback.classic.encoder.patternlayoutencoder"> <outputpatternasheader>true</outputpatternasheader> <pattern>[%thread] %-5level %logger{35} - %msg%n</pattern> </encoder>
how can add own parameters in pattern? like:
<pattern>[%thread] %-5level %logger{35} %user.name %status - %msg%n</pattern>
consider use of logback mapped diagnostic contexts mdc put parameter in mdc mdc.put( "username", "george" );
.
print patternlayout <pattern>[%thread] %-5level %logger{35} %x{username} %status - %msg%n</pattern>
Comments
Post a Comment