When implementing some filters this weekend I found that there is a flaw in
the set of filters that log4j provides in the varia package, at least in my
opinion.  Primarily, using the AcceptOnMatch property, it is very easy to
create a filter chain of "OR" type tests, but very difficult to create a
filter chain of "AND" type.  At least it looks that way to me.  Maybe this
isn't a big deal.

By "OR" type filter chain I mean a logging event is either accepted/denied
if it matches filter 1 OR filter 2 OR filter 3, etc.  If the event does not
match the filter criteria, it is passed on to the next filter.

By "AND" type filter chain I mean a logging event is either accepted/denied
if it matches filter 1 AND filter 2 AND filter 3, etc.  If the event does
not match the filter criteria it is denied.  When it matches the filter
criteria, it is passed to the next filter via Filter.NEUTRAL.  Optionally,
when an event does not match, you could have the filter accept the event
instead of deny it (this allows passthru filters, like SetLevelInfoFilter,
to process some event but not others).

The AcceptOnMatch property/concept doesn't handle the AND case very well.  I
admit that my previous filter submissions were more complicated than they
needed to be, but they did allow both OR and AND type filter chains with
simple runtime configuration settings.  Does anyone else think this is
important?  Am I missing something or spending too much time on what is
essentially a simple matter?

I have come up with an idea of how to extend the current set of filters to
allow OR and AND while maintaining backward compatibility, but I want to
hear what others think before I propose it.

-Mark

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to