Hi Mark, You can create your own conversion specifier. Here is how:
https://logback.qos.ch/manual/layouts.html#customConversionSpecifier Best regards, -- Ceki Gülcü Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch On 6/24/2022 10:07 PM, Mark Raynsford wrote: > Hello! > > I have an application where parts of the application set a "domain" > MDC value where appropriate, and unset it later when it's no longer > applicable. > > I'd like to use something like the following when "domain" is set: > > <appender name="STDERR" > class="ch.qos.logback.core.ConsoleAppender"> > <encoder> > <pattern>%level %logger [%X{domain}] %msg%n</pattern> > </encoder> > </appender> > > ... and something like the following when "domain" _isn't_ set: > > <appender name="STDERR" > class="ch.qos.logback.core.ConsoleAppender"> > <encoder> > <pattern>%level %logger %msg%n</pattern> > </encoder> > </appender> > > Is this possible? I'm not seeing anything in the manual that would > suggest it is. > _______________________________________________ logback-user mailing list logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user