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
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to