Issue Type: Bug Bug
Affects Versions: 1.1.2
Assignee: Logback dev list
Attachments: logback.xml
Components: logback-core
Created: 18/Nov/14 6:21 PM
Description:

I do issue 10 error message using this code:

final Logger log = LoggerFactory.getLogger("myLogger");
for(int i = 0; i<10; i++)
log.error("myMessage" + i);

I configured logback.xml (attached) to write to console and to send emails. Console says:

17:56:21.172 [http-bio-8443-exec-1] ERROR myLogger - myMessage0
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage1
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage2
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage3
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage4
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage5
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage6
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage7
17:56:21.175 [http-bio-8443-exec-1] ERROR myLogger - myMessage8
17:56:21.175 [http-bio-8443-exec-1] ERROR myLogger - myMessage9

which is perfect.
Also ch.qos.logback.classic.ViewStatusMessagesServlet shows my emails with 10 rows saying

INFO | SMTPAppender | About to send out SMTP message "ERROR myLogger myMessageNNN" to [xxx@xxx.yyy.com]

with N in 0 to 9, but the order of emails is shuffled to 7-0-9-2-8-1-4-3-5-6, which is still ok.

But unfortunatly, in my email account I find 10 equal emails, all with subject "ERROR myLogger myMessage8" and body

-----------------
ERROR myLogger

myMessage6
-----------------

So instead of sending 10 emails, one of them is sent 10 times. Even worse, subject and body of that email do not correspond to each other.

All 10 emails do have exactly the same Message-ID.

I tried this with logback 1.1.2, 1.1.1, and 1.1.0 (fetched from mvnrepository) and it always shows the same behaviour.

I tried it with two different smtp servers of my employer, and I did access both via Thunderbird and SquirrelMail, but this makes no difference.

If I do a "Thread.sleep(1000)" before each log.error, everything works as expected.

Environment:

Linux 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Project: logback
Priority: Major Major
Reporter: Ralf Wiebicke
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira