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

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -