[logback-user] Multiple layouts for a single appender
Y M
ym119162 at hotmail.com
Thu May 24 15:16:36 CEST 2012
> Date: Thu, 24 May 2012 12:17:02 +0200
>
> There is support exactly for this type of situation. See the docs for
> PatternLayout [1]. In particular, the docs on %ex conversion
> word. Here is the relevant quote:
>
> This conversion word can also use evaluators to test logging events
> against a given criterion before creating the output. For example,
> using %ex{full, EX_DISPLAY_EVAL} will display the full stack trace of
> the exception only if the evaluator called EX_DISPLAY_EVAL returns a
> negative answer. Evaluators are described further down in this
> document.
>
> Refer to [2] for evaluators.
>
> Let us know if this approach works for you.
>
>
> [1] http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout
> [2] http://logback.qos.ch/manual/layouts.html#Evaluators
>
> --
> Ceki
> http://twitter.com/#!/ceki
Well, how could it not work? I changed my config to:
<evaluator name="CALLER_EVAL" class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> <marker>MY_MARKER</marker></evaluator>...<pattern>... %n%xThrowable{full, CALLER_EVAL}%caller{5, CALLER_EVAL}</pattern>
Just what I need. Sorry about this RTFM.
Thanks, ceki.
More information about the Logback-user
mailing list