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 Sat, 27 Nov 2010 03:44:55 GMT
You can use parens for grouping and then use ands and ors:

<param name="Expression" value="( LOGGER ~= class1 &amp;&amp; MSG ~= test1 )
|| ( logger ~= class2 &amp;&amp; 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