[logback-user] log4j StringMatchFilter porting to logback
ceki at qos.ch
Tue Feb 22 18:11:37 CET 2011
On 22/02/2011 5:47 PM, Fabio Erculiani wrote:
> Hi there, it's me again,
> just wondering, what's the best way to reproduce the behaviour of
> log4j StringMatchFilter in logback?
> Do I have to use ch.qos.logback.core.filter.EvaluatorFilter ?
You can re-write StringMatchFilter by extending Filter or
AbstractMatcherFilter classes both located in the
You could also learn to use EvaluatorFilter with GEventEvaluator (takes
an expression in Groovy) or JaninoEventEvaluator (takes an expression in
Java. See  for details.
Re-writing StringMatchFilter should be rather easy and will not require
any other dependencies. Using JaninoEventEvaluator will require Janino
and GEventEvaluator will require the Groovy runtime. However,
JaninoEventEvaluator/GEventEvaluator are much easier to extend should
your needs go beyond just string matching on the log message.
More information about the Logback-user