logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Deboy <scott.de...@gmail.com>
Subject Re: Multiple expressions define in one ExpressionFilter?
Date Mon, 29 Nov 2010 16:54:44 GMT
I doubt there is much of a difference - that's something you would need to
measure for yourself to answer.

Scott

On Mon, Nov 29, 2010 at 8:38 AM, Tech Newbie <technb@yahoo.com> wrote:

> Thanks.  Is there any performance differences if I put multiple expressions
> in one ExpressionFilter using using () as you described:
> <filter class="org.apache.log4j.filter.ExpressionFilter">
>
>    <param name="Expression" value=" ( LOGGER ~= class1 && MSG ~= test1" )
> ||
>
> ( LOGGER ~= class2 && MSG ~= test2") />
>
>    <param name="AcceptOnMatch" value="false"/>
>
> </filter>
>
>
> versus using multiple ExpressionFilter sections, each with one expression:
> <filter class="org.apache.log4j.filter.ExpressionFilter">
>    <param name="Expression" value="LOGGER ~= class1 && MSG ~= test1"/>
>    <param name="AcceptOnMatch" value="false"/>
> </filter>
> <filter class="org.apache.log4j.filter.ExpressionFilter">
>
>    <param name="Expression" value="LOGGER ~= class2 && MSG ~= test2"/>
>
>    <param name="AcceptOnMatch" value="false"/>
>
> </filter>
>
>
> Thanks again.
>
> --- On Sat, 11/27/10, Scott Deboy <scott.deboy@gmail.com> wrote:
>
> From: Scott Deboy <scott.deboy@gmail.com>
> Subject: Re: Multiple expressions define in one ExpressionFilter?
> To: "Log4J Users List" <log4j-user@logging.apache.org>
> Date: Saturday, November 27, 2010, 3:44 AM
>
> You can use parens for grouping and then use ands and ors:
>
> <param name="Expression" value="( LOGGER ~= class1 && MSG ~= test1 )
> || ( logger ~= class2 && MSG ~= TEST2 )"/>
>
> With the latest release of extras you don't need spaces around parens,
> operators or keywords, but I added them for readability.
>
> Scott
>
> On Fri, Nov 26, 2010 at 5:11 PM, Tech Newbie <technb@yahoo.com> wrote:
>
> > Is it possible to define multiple expressions in one single
> > ExpressionFilter?  For example, I want to filter out two different texts
> in
> > two different classes but this doesn't work.  Only the 2nd definition
> takes
> > effect.
> >
> > <filter class="org.apache.log4j.filter.ExpressionFilter">
> >   <param name="Expression" value="LOGGER ~= class1 && MSG ~= test1"/>
> >   <param name="Expression" value="LOGGER ~= class2 && MSG ~= test2"/>
> >   <param name="AcceptOnMatch" value="false"/>
> > </filter>
> >
> > I have to separate them out in their individual <filter> element.
> >
> >
> >
> >
> >
>
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message