2 Replies Latest reply on Apr 11, 2006 10:49 AM by Jimmy Wilson

    Logging level for SMTPAppender

    Daniel Zollinger Newbie

      Hi,

      We are using JBoss 4.0.4RC1 and I have the following definition in my log4j.xml file



















      The problem I have is that it doesn't seem to matter what value I set the Threshold or filter/LevelMin values to, I only ever get emails for ERROR or FATAL log events.

      Does anybody have any idea why?

      Regards,

        • 1. Re: Logging level for SMTPAppender
          Daniel Zollinger Newbie

          Sorry, Lost the XML from the original post.

          <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
           <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
           <param name="EvaluatorClass"
           value="org.jboss.logging.appender.WarnLevelEventEvaluator"/>
           <param name="Threshold" value="INFO"/>
           <param name="To"
           value="daniel.zollinger@transtoll.com,dion.mcmurtrie@transtoll.com,ean.dungey@transtoll.com,larry.edwardson@transtoll.com,mark.french@transtoll.com,robin.palfreyman@transtoll.com"/>
           <param name="From" value="daniel.zollinger@transtoll.com"/>
           <param name="Subject" value="Dent: JBoss Server Errors"/>
           <param name="SMTPHost" value="192.168.1.13"/>
           <param name="BufferSize" value="10"/>
           <layout class="org.apache.log4j.PatternLayout">
           <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{3}] %m%n"/>
           </layout>
           <filter class="org.apache.log4j.varia.LevelRangeFilter">
           <param name="LevelMin" value="INFO"/>
           <param name="LevelMax" value="FATAL"/>
           </filter>
           </appender>


          • 2. Re: Logging level for SMTPAppender
            Jimmy Wilson Apprentice

             

            "dzollinger" wrote:
            The problem I have is that it doesn't seem to matter what value I set the Threshold or filter/LevelMin values to, I only ever get emails for ERROR or FATAL log events.


            The issue is likely that the SMTPAppender uses the concept of a triggering event. Log messages that are not triggering events are stored in a cyclical buffer whose size is governed by the SMTPAppender.BufferSize attribute. When a log message that is a triggering event is sent to the appender, that message, plus the messages in the cyclical buffer are sent out via the appender.

            The SMTPAppender.EvaluatorClass attribute is used to setup what determines the triggering event. If this attribute is not set, the default trigger is any message whose level is greater than or equal to ERROR. To change this, you will need to write your own evaluator class. The TriggeringEventEvaluator Javadoc should be helpful in doing this.