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.