LevelRangeFilter can be configured to have sent only ERRORs and FATALs:
<appender class="org.apache.log4j.net.SMTPAppender" name="smtp"> <param name="To" value="Support@yourcompany.com" /> <param name="From" value="" /> <param name="Subject" value="An error occured" /> <param name="SMTPHost" value="localhost" /> <param name="BufferSize" value="100" /> <param name="Threshold" value="ERROR" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{HH:mm:ss} %-5p %t %c - %m%n" /> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="ERROR" /> <param name="LevelMax" value="FATAL" /> </filter> </appender>
If you want to include information about the exception in the subject, see here.
No comments:
Post a Comment