[logback-user] How to configure Logback to filter out anything that does not have a specific marker

Robert Krüger krueger at lesspain.de
Sun Jul 26 17:21:36 CEST 2015


On Sun, Jul 26, 2015 at 4:00 PM, Paul Krause <pkrause at investsoftech.com>
wrote:

> My first reaction is to say stop using isDebugEnabled(). You shouldn't
> need to do that.
>
>
Maybe in some cases its overkill but in some cases I build more expensive
data structures/representations only for logging which I need to avoid when
logging with fine granularity in performance-critical area


> But if you really must, then try using  isDebugEnabled(Marker) with
> debug(Marker,...).
>
>
Great, that solves one of my problems.

The only remaining one I have also solved. I did non stumble accross the
"OnMismatch" directive until now. Changing my example to this here,

  <turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
    <Marker>performance</Marker>
    <OnMismatch>DENY</OnMismatch>
  </turboFilter>

together with isDebugEnabled(Marker) and setting the levels of the
individual loggers gives me the solution to 1) (not exactly but good enough)

and the same with OnMatch ACCEPT gives me the setup for 2)


> Hope this helps,
> Paul
>
>
It sure did. Thanks a lot!
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20150726/ef8a0746/attachment.html>


More information about the Logback-user mailing list