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: LikeRule in Apache Extras Companion (used by ExpressionFilter)
Date Tue, 10 May 2011 05:32:28 GMT
I tried this in Chainsaw and it worked fine...note the single quotes and
adding .* before and after the expression..single quotes probably aren't
necessary unless you have spaces in your regexp..one other thing: I'm not
escaping the slashes since you don't have to escape them in Chainsaw.

msg like '.*\b\(\d{3}\)\s.*'

matches this entry:
743 - 2011/04/27 14:23:57 -  - DEBUG - Unknown - 20110427 14:25:38.605
ERROR    RI.TEST- testAppThread accept(316) failed? -  - AWT-EventQueue-0

Scott

On Mon, May 9, 2011 at 2:55 PM, Dasgupta, Ranjan
<Ranjan_Dasgupta@dell.com>wrote:

> In the LikeRule evaluate(...) method, the matcher uses the
> matcher.matches(...) which checks for the whole string to match to.
> Shouldn't it be using the matcher.find(), so that we do not log if a part of
> the log string matched the pattern provided? Or is there any other way of
> doing that?
> I am trying not to log messages that match \\b\\d{13,16}\\b
>
>                        <filter
> class="org.apache.log4j.filter.ExpressionFilter">
>                                <param name="Expression" value="MSG LIKE
> \\b\\d{13,16}\\b"/>
>                                <param name="AcceptOnMatch" value="false"/>
>                        </filter>
> Thanks,
> Ranjan Dasgupta
>
>
>
>

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