Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-975

asynchronousSending on SMTPAppender loses messages if enabled

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.0.13
    • logback-classic
    • jdk1.7.0_51

    Description

      I have an application that I'm currently testing with the SMTPAppender. The application currently has test logic like the following...

      def main(args: Array[String]) {
      <configure logging>
      error("Error 1", new IOException("IOE 1"))
      error("Error 2", new IOException("IOE 2"))
      error("Error 3", new IOException("IOE 3"))
      error("Error 4", new IOException("IOE 4"))
      <run forever>
      }

      When disabling asynchronousSending, all is fine. When enabling asynchronousSending, I'm only receiving 1 e-mail from the 4 error messages. The 1 e-mail that I get has a mix of errors from the 4 errors in the snippit above.

      I get an email with the subject "Error 1" but in the body, it says "Error 4".

      e.g.
      Subject:
      ERROR - Tonys-MacBook-Pro.local - c.server.App$ - Error 4

      Body:
      2014-04-14 16:49:55,592 ERROR com.server.App$ - Error 1
      java.io.IOException: IOE 1
      at com.server.App$.main(App.scala:33)
      at com.server.App.main(App.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

      Here's my config:

      <appender name="EMAILER" class="ch.qos.logback.classic.net.SMTPAppender">
      <smtpHost>smtp.xx.net</smtpHost>
      <smtpPort>587</smtpPort>
      <STARTTLS>true</STARTTLS>
      <username>xx@xx.com</username>
      <password>xx</password>

      <to>xx@xx.com</to>
      <from>xx@xx.com</from>
      <asynchronousSending>false</asynchronousSending>
      <includeCallerData>true</includeCallerData>

      <subject>ERROR - ${HOSTNAME} - %logger

      {20}

      - %message</subject>
      <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%date %-5level %logger - %message%n%ex</pattern>
      </layout>

      <!-- Only accept logs of ERROR or higher -->
      <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>ERROR</level>
      </filter>
      </appender>

      Attachments

        Activity

          People

            logback-dev Logback dev list
            tonymeng Tony Meng
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: