Bug 32572 - Would like to use Filter's as TriggeringEventEvaluator's for SMTPAppender
Would like to use Filter's as TriggeringEventEvaluator's for SMTPAppender
Status: RESOLVED FIXED
Product: Log4j
Classification: Unclassified
Component: Appender
1.2
PC Windows 2000
: P2 enhancement
: ---
Assigned To: log4j-dev
:
: 42823 (view as bug list)
Depends on:
Blocks: 42823
  Show dependency tree
 
Reported: 2004-12-07 19:23 UTC by sschwell
Modified: 2014-02-17 13:51 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sschwell 2004-12-07 19:23:02 UTC
There are already a few useful implementations of Filter. It would be nice if 
we could also use those implems as TriggeringEventEvaluator's for SMTPAppender.

This would be trivial to accomplish by having Filter implement 
TriggeringEventEvaluator interface and adding the following method to Filter:

public boolean isTriggeringEvent(LoggingEvent event) {
  return (decide(event) == ACCEPT);
}

Related to this - it would be nice if DOMConfigurator allowed specification and 
config of TriggeringEventEvaluator's for SMTPAppender, similarly to how it 
allows Filters to be specified.

Thanks,
Steve
Comment 1 Curt Arnold 2005-08-22 01:03:50 UTC
Should reconcile this with o.a.l.rolling.TriggeringPolicy which has similar semantics (but provides more 
than just the event to make the decision).  A possible solution would be to have RFA check for 
TriggeringPolicy and if not found check for TriggeringEventEvaluator and wrap the TEE to provide the TP 
interface.

Ideally Filter (or the Filter proxy) would support both interfaces.
Comment 2 Curt Arnold 2007-08-21 14:47:49 UTC
*** Bug 42823 has been marked as a duplicate of this bug. ***
Comment 3 Curt Arnold 2007-08-21 22:36:41 UTC
Added SMTPAppender.setEvaluator() to programatically set TriggeringEventEvaluator and added support 
for nested triggeringPolicy elements in XML configuration.  The 
org.apache.log4j.rolling.FilterBasedTriggeringPolicy in the extras companion now supports 
org.apache.log4j.spi.TriggeringEventEvaluator in addition to org.apache.log4j.rolling.TriggeringPolicy and 
can be used with both RollingFileAppender and SMTPAppender to trigger based on filters.