logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dasgupta, Ranjan" <Ranjan_Dasgu...@dell.com>
Subject RE: LikeRule in Apache Extras Companion (used by ExpressionFilter)
Date Tue, 10 May 2011 14:52:42 GMT
Scott, thanks for the quick reply. After looking at your example, I ended up with something
MSG LIKE .*\\b\\d{13,16}.*

Appreciate your help.

Ranjan Dasgupta

-----Original Message-----
From: Scott Deboy [mailto:scott.deboy@gmail.com] 
Sent: Tuesday, May 10, 2011 1:32 AM
To: Log4J Users List
Subject: Re: LikeRule in Apache Extras Companion (used by ExpressionFilter)

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


On Mon, May 9, 2011 at 2:55 PM, Dasgupta, Ranjan

> 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

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message