[logback-user] Can I have level specific patterns?

Andrew E. Davidson adavidson2 at apple.com
Sat Apr 11 01:21:35 CEST 2015


Thanks Ceki

Andy
> On Apr 10, 2015, at 2:58 PM, Ceki Gülcü <ceki at qos.ch> wrote:
> 
> 
> There is no out-of-the-box support for level-specific patterns in logback at this time.
> 
> You could of course write your own layout which does what you describe.
> See http://logback.qos.ch/manual/layouts.html#writingYourOwnLayout
> for documentation on this topic.
> 
> Alternatively, you could write a custom conversion specifier. If you had a specifier called %debug which output contents only for level DEBUG, and a %warn specifier which output contents only for level WARN and another specifier %ERROR which output contents for ERROR, your pattern could be written as
> 
> %debug(%level %d %t) %error(%level) %info(%level) %m%n
> 
> See http://logback.qos.ch/manual/layouts.html#customConversionSpecifier
> for documentation on this topic.
> 
> 
> 
> On 4/10/2015 21:36, Andrew E. Davidson wrote:
>> Is it possible to have a logbook-text.xml file that defines two different patterns? For example
>> 
>> if the level is debug, I want the level, time stamp, thread, file, line number, and message.
>> 
>> If the level is error or warn, I want the level and message
>> 
>> If the level is info I just want the message
>> 
>> Thanks
>> 
>> Andy
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user



More information about the Logback-user mailing list