SMTP appender is currently hardcoded to send emails when an ERROR level request is processed. This can be customized by providing an implementation of TriggeringEventEvaluator and specifying evaluatorClass in the configuration file, but that requires you to provide a user-written class. This issue was discussed on log4j-user on 2007-07-04 (http://mail-archives.apache.org/mod_mbox/ logging-log4j-user/200707.mbox/%3c405794.99416.qm@web7609.mail.in.yahoo.com%3e) and previously in 17-Jan-2002. Also bug 32572 proposing allowing Filter's to serve as TriggeringEventEvaluators. Possible resolutions: 1. Add a triggeringLevel attribute, if set this would replace the current TriggeringEventEvaluator. 2. Add a triggeringFilter nested element that would allow a user specified filter to act as a TEE (per suggestion in 32572) and replace current TEE. Triggering on an arbitrary level would require use of o.a.l.varia.LevelRangeFilter. 3. Both of the above. Triggering on current threshold is not acceptible since it would change deployed behavior and someone might be depending on the current behavior.
Another possibility would be to support o.a.l.rolling.TriggeringPolicy. That would superset the capabilities of a triggeringFilter since there is a FilterBasedTriggeringPolicy in o.a.l.rolling plus it would allow size based triggering (however msg size is not currently calculated). However, that would require moving o.a.l.rolling.TriggeringPolicy from extras to log4j proper and other unpleasantness. Probably best just to add setTrigger(Level) and leave the fancy stuff for log4j 2.0.
(In reply to comment #1) > plus it would allow size based triggering Would a size based triggering really be useful? I mean, would the size of the message be considered important for triggering the mails?
*** This bug has been marked as a duplicate of 32572 ***