title: Log4j2: SMTPAppender does not send mails with error or fatal level
body: <p>I recognized some problems with the SMTPAppender in log4j2. Whenever log events with the level <code>error</code> or <code>fatal</code> are created <strong>without</strong> having an event with the level <code>info</code> before no mail is sent and the fatal event disappears.</p>
  
  <p>Here is my log4j2 configuration file (log4j2.xml) and a small program (LogTest.java) to reproduce the problem:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;configuration status="warn"&gt;
  
          &lt;!-- mail server configuration --&gt;
          &lt;properties&gt;
              &lt;property name="receipients"&gt;me@example.com&lt;/property&gt;
              &lt;property name="from"&gt;me@example.com&lt;/property&gt;
              &lt;property name="smtpHost"&gt;smtp.example.com&lt;/property&gt;
              &lt;property name="smtpPort"&gt;25&lt;/property&gt;
              &lt;property name="smtpProtocol"&gt;smtp&lt;/property&gt;
              &lt;property name="smtpUser"&gt;me&lt;/property&gt;
              &lt;property name="smtpPassword"&gt;secret&lt;/property&gt;
          &lt;/properties&gt;
  
      &lt;appenders&gt;
  
          &lt;!-- appender to write all info events to stdout --&gt;
          &lt;Console name="Console" target="SYSTEM_OUT"&gt;
              &lt;ThresholdFilter level="info" onMatch="NEUTRAL" onMismatch="DENY"/&gt;
          &lt;/Console&gt;
  
          &lt;!-- appender to send mails (default: error and fatal events)--&gt;
          &lt;SMTP name="Mailer" suppressExceptions="false"
                subject="Error log" to="${receipients}" from="${from}"
                smtpHost="${smtpHost}" smtpPort="${smtpPort}"
                smtpProtocol="${smtpProtocol}" smtpUsername="${smtpUser}" 
                smtpPassword="${smtpPassword}" smtpDebug="false" bufferSize="2"&gt;
          &lt;/SMTP&gt;
          &lt;!-- appender to send mails asynchronously --&gt;
          &lt;Async name="AsyncMailer" &gt; 
              &lt;appender-ref ref="Mailer"/&gt;
          &lt;/Async&gt;
  
      &lt;/appenders&gt;
      &lt;loggers&gt;
  
          &lt;!-- logger to send mail on (at least) info level events --&gt;
          &lt;logger name="LogTest" level="info" additivity="true"&gt;
              &lt;appender-ref ref="AsyncMailer"/&gt;
          &lt;/logger&gt;
  
          &lt;!-- root logger to see what happens (info level and "above") --&gt;
          &lt;root level="info"&gt;
              &lt;appender-ref ref="Console"/&gt;
          &lt;/root&gt;
  
      &lt;/loggers&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <hr>
  
  <p>I used this small program to reproduce the problem (LogTest.java):</p>
  
  <pre><code>import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  class LogTest
  {
      private static Logger logger=LogManager.getLogger("LogTest");
  
      public void testlogger()
      {
          /* --&gt; uncomment to enable first mail
          logger.info("test info 1");
          */
          logger.fatal("test fatal 1");
  
          /* --&gt; uncomment to enable second mail
          logger.info("test info 2");
          */
          logger.fatal("test fatal 2");
      }
  
      public static void main(String[] args)
      {
          LogTest app=new LogTest();
          app.testlogger();
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>If you uncomment the two marked positions everything work like intended: two mails are sent - each containing the fatal-event and the prior info event. Additionally the 4 events are printed to stdout:</p>
  
  <pre><code>test info 1
  test fatal 1
  test info 2
  test fatal 2
  </code></pre>
  
  <p>Now, if you only activate/uncomment the second position - the second mail (fatal2) is sent as intended (again with the prior info2 event), but even though the first fatal event is printed to stdout the mail is eaten up. The output looks as follows:</p>
  
  <pre><code>test fatal 1
  test info 2
  test fatal 2
  </code></pre>
  
  <hr>
  
  <p>Personally, for me it seems like I got something wrong and mis-configured log4j2 or it might be a bug.</p>
  
  <p>Thanks for your help in advance.</p>
  
  <p>*Jost</p>
  
  <p>Note:</p>
  
  <p>For the tests I used <a href="http://logging.apache.org/log4j/2.x/download.html" rel="noreferrer" title="log4j2 download">log4j2-beta7</a> downloaded from the project's website.
  The documentation can be found <a href="http://logging.apache.org/log4j/2.x/manual/index.html" rel="noreferrer" title="log4j2 manual">here</a>.</p>