views:

20

answers:

1

Right now we have an appender similar to...

<appender name="email" class="org.apache.log4j.net.SMTPAppender">

When the appender fails to send a mail, we get multiple lines of this in our file (and inboxes, due to nature of our logging)...

[2010 Sep 21 01:00:47] ERROR (FixSession.java:453) - log4j:ERROR Error occured while sending e-mail notification.

Would there be a way to only log once or disable internal logging for this appender only?

Note: already tried errorHandler, it seems the SMTPAppender uses LogLog rather than a given handler... source at http://logging.apache.org/log4j/1.2/xref/org/apache/log4j/net/SMTPAppender.html

A: 

LogLog is very simplistic, it simply writes errors to System.err. You can only turn it off completely using LogLog.setQuietMode(true)

Probably the only way out for you is to create your own appender, based on SNMPTAppender and then add your own error handling. This shouldn't be too difficult, though.

yshalbar