logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Deboy" <sde...@comotivsystems.com>
Subject RE: clarification about AndFilter ....
Date Sat, 30 Apr 2005 15:59:37 GMT
Unit tests need to be written for AndFilter.  I'll write the unit tests when I can find some
time.

If you are interested in providing unit tests and a patch we'd be happy to accept them!

1 - sounds like a bug
2 - filters can be chained - this style allows an 'and' filter to be followed by other filters
in the chain if the criteria expected by andFilter does not apply to the event.  You can always
add a DenyAllFilter after the AndFilter to achieve this capability.
3 - or filter should not be needed since filters can already be chained (or'd) (at least it
seems this way to me - maybe I'm missing something)
4 - I'm not sure when the next release will be

Hope this helps 

Scott


-----Original Message-----
From:	Sumit Kumar [mailto:sumitk@novell.com]
Sent:	Mon 4/25/2005 11:47 PM
To:	log4j-dev@logging.apache.org
Cc:	
Subject:	clarification about AndFilter ....
Hi All,

It's really good to see AndFilter in 1.3. It will help me really a
lot. Here I need some clarification about AndFilter (and some general
queries).

(Forgive me if I am wrong somewhere)

1. Why AndFilter checks for every added filter in the list when the
earlier one returns false.
(Code is:-
boolean accepted = true;    	
while (f != null) {
      accepted = accepted && (Filter.ACCEPT == f.decide(event));
      f = f.getNext();
}

I felt it should be 
boolean accepted = true;    	
while (accepted && f != null) {
      accepted = accepted && (Filter.ACCEPT == f.decide(event));
      f = f.getNext();
}
)

2. Why it returns neutral when the accepted is false.
(Code is
if(accepted) {
      if(acceptOnMatch) {
        return Filter.ACCEPT;
      }
       return Filter.DENY;
}
return Filter.NEUTRAL;

I felt it should be 
if(accepted) {
      if(acceptOnMatch) {
        return Filter.ACCEPT;
      }
       return Filter.DENY;
}
return Filter.DENY;

(I thought NEUTRAL should be in that case when I added an OR filter
(and not AndFiler)).

(3) Is there any ORFilter or any plan for that ?

(4) I am very curious to use 1.3 (it has some of the feature I needed
!!!). when is the stable release expected ?
(sorry to ask that if it is too early to ask.)

I feel there might be some rationale behind (2), but doesn't understand
that. For me, (1) is a coding error.

Waiting for reply ... :-w

cheers ....
Sumit

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





Mime
View raw message