<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
#email-body { min-width: 30em !important; }
#email-page { padding: 8px !important; }
#email-banner { padding: 8px 8px 0 8px !important; }
#email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
#email-fields { padding: 0 8px 8px 8px !important; }
#email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
<tr valign="top">
<td id="email-page" style="padding:16px !important;">
<table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
<tr valign="top">
<td bgcolor="#003366" style="background-color:#003366;color:#ffffff;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="http://jira.qos.ch/s/en_USb9v8he-418945332/850/25/_/jira-logo-scaled.png" alt="" style="vertical-align:top;" /></td>
</tr><tr valign="top">
<td id="email-banner" style="padding:32px 32px 0 32px;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
<img id="email-avatar" src="http://jira.qos.ch/secure/useravatar?avatarId=10122" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
<div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
<a class="user-hover" rel="alexlumpov" id="email_alexlumpov" href="http://jira.qos.ch/secure/ViewProfile.jspa?name=alexlumpov" style="color:#326ca6;">Alex Lumpov</a>
created <img src="http://jira.qos.ch/images/icons/issuetypes/bug.png" height="16" width="16" border="0" align="absmiddle" alt="Bug"> <a style='color:#326ca6;text-decoration:none;' href='http://jira.qos.ch/browse/LOGBACK-909'>LOGBACK-909</a>
</div>
<div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
<a style='color:#326ca6;text-decoration:none;' href='http://jira.qos.ch/browse/LOGBACK-909'><strong>SMTPAppender synchronization problem in Asynchronous mode</strong></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td id="email-fields" style="padding:0 32px 32px 32px;">
<table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
<tr valign="top">
<td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Issue Type:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<img src="http://jira.qos.ch/images/icons/issuetypes/bug.png" height="16" width="16" border="0" align="absmiddle" alt="Bug"> Bug
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Affects Versions:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
1.0.13 </td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Assignee:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<a class="user-hover" rel="logback-dev@qos.ch" id="email_logback-dev@qos.ch" href="http://jira.qos.ch/secure/ViewProfile.jspa?name=logback-dev%40qos.ch" style="color:#326ca6;">Logback dev list</a>
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Components:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
logback-classic </td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Created:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
09/Oct/13 8:17 PM
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Description:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<p style='margin-top:0;margin-bottom:10px;'>Method SMTPAppender.sendBuffer using mimeMsg, but not synchronized</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>App.java</b></div><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">package</span> com.mycompany.mavenproject4;
<span class="code-keyword">import</span> ch.qos.logback.classic.Logger;
<span class="code-keyword">import</span> ch.qos.logback.classic.LoggerContext;
<span class="code-keyword">import</span> ch.qos.logback.classic.PatternLayout;
<span class="code-keyword">import</span> ch.qos.logback.classic.net.SMTPAppender;
<span class="code-keyword">import</span> ch.qos.logback.classic.spi.ILoggingEvent;
<span class="code-keyword">import</span> ch.qos.logback.core.Layout;
<span class="code-keyword">import</span> ch.qos.logback.core.status.OnConsoleStatusListener;
<span class="code-keyword">import</span> com.icegreen.greenmail.util.GreenMail;
<span class="code-keyword">import</span> com.icegreen.greenmail.util.GreenMailUtil;
<span class="code-keyword">import</span> com.icegreen.greenmail.util.ServerSetup;
<span class="code-keyword">import</span> javax.mail.Multipart;
<span class="code-keyword">import</span> javax.mail.internet.MimeMessage;
<span class="code-keyword">public</span> class App {
<span class="code-keyword">private</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">String</span> DEFAULT_PATTERN = <span class="code-quote">"%-4relative %mdc [%thread] %-5level %class - %msg%n"</span>;
<span class="code-keyword">private</span> LoggerContext loggerContext = <span class="code-keyword">new</span> LoggerContext();
<span class="code-keyword">private</span> Logger logger = loggerContext.getLogger(<span class="code-keyword">this</span>.getClass());
<span class="code-keyword">private</span> GreenMail greenMail;
<span class="code-keyword">public</span> <span class="code-keyword">static</span> void main(<span class="code-object">String</span>... args) <span class="code-keyword">throws</span> Exception {
App app = <span class="code-keyword">new</span> App();
app.test();
}
<span class="code-keyword">public</span> void test() <span class="code-keyword">throws</span> Exception {
OnConsoleStatusListener.addNewInstanceToContext(loggerContext);
startGreenMail();
<span class="code-keyword">try</span> {
SMTPAppender smtpAppender = buildSMTPAppender();
smtpAppender.start();
logger.addAppender(smtpAppender);
logger.error(<span class="code-quote">"Message1"</span>);
logger.error(<span class="code-quote">"Message2"</span>);
greenMail.waitForIncomingEmail(5000, 2);
<span class="code-keyword">for</span> (MimeMessage mimeMessage : greenMail.getReceivedMessages()) {
<span class="code-object">String</span> subject = mimeMessage.getSubject();
Multipart multipart = (Multipart) mimeMessage.getContent();
<span class="code-object">String</span> body = GreenMailUtil.getBody(multipart.getBodyPart(0));
<span class="code-object">System</span>.out.println(<span class="code-quote">"subject="</span> + subject);
<span class="code-object">System</span>.out.println(<span class="code-quote">"body="</span> + body);
<span class="code-object">System</span>.out.println();
}
} <span class="code-keyword">finally</span> {
stopGreenMail();
}
}
<span class="code-keyword">private</span> void startGreenMail() <span class="code-keyword">throws</span> InterruptedException {
greenMail = <span class="code-keyword">new</span> GreenMail(<span class="code-keyword">new</span> ServerSetup(25, <span class="code-quote">"localhost"</span>, ServerSetup.PROTOCOL_SMTP));
greenMail.start();
<span class="code-object">Thread</span>.currentThread().sleep(50);
}
<span class="code-keyword">private</span> void stopGreenMail() {
greenMail.stop();
}
<span class="code-keyword">private</span> SMTPAppender buildSMTPAppender() {
SMTPAppender smtpAppender = <span class="code-keyword">new</span> SMTPAppender();
smtpAppender.setContext(loggerContext);
smtpAppender.setSubject(<span class="code-quote">"%msg"</span>);
smtpAppender.addTo(<span class="code-quote">"nospam@qos.ch"</span>);
smtpAppender.setAsynchronousSending(<span class="code-keyword">true</span>);
smtpAppender.setLayout(buildPatternLayout());
<span class="code-keyword">return</span> smtpAppender;
}
<span class="code-keyword">private</span> Layout<ILoggingEvent> buildPatternLayout() {
PatternLayout layout = <span class="code-keyword">new</span> PatternLayout();
layout.setContext(loggerContext);
layout.setPattern(DEFAULT_PATTERN);
layout.start();
<span class="code-keyword">return</span> layout;
}
}
</pre>
</div></div>
<div class="panel" style="border-width: 1px;"><div class="panelHeader" style="border-bottom-width: 1px;"><b>output1</b></div><div class="panelContent">
<p style='margin-top:0;margin-bottom:10px;'>22:03:00,396 |-INFO in ch.qos.logback.classic.net.SMTPAppender<span class="error">[null]</span> - SMTPAppender <span class="error">[null]</span> is tracking <span class="error">[1]</span> buffers<br/>
22:03:00,412 |-INFO in ch.qos.logback.classic.net.SMTPAppender<span class="error">[null]</span> - About to send out SMTP message "Message2" to <span class="error">[nospam@qos.ch]</span><br/>
22:03:00,413 |-INFO in ch.qos.logback.classic.net.SMTPAppender<span class="error">[null]</span> - About to send out SMTP message "Message1" to <span class="error">[nospam@qos.ch]</span><br/>
subject=Message1<br/>
body=225 <span class="error">[main]</span> ERROR ? - Message1</p>
<p style='margin-top:0;margin-bottom:10px;'>subject=Message1<br/>
body=225 <span class="error">[main]</span> ERROR ? - Message1</p>
</div></div>
<div class="panel" style="border-width: 1px;"><div class="panelHeader" style="border-bottom-width: 1px;"><b>output2</b></div><div class="panelContent">
<p style='margin-top:0;margin-bottom:10px;'>22:03:29,514 |-INFO in ch.qos.logback.classic.net.SMTPAppender<span class="error">[null]</span> - SMTPAppender <span class="error">[null]</span> is tracking <span class="error">[1]</span> buffers<br/>
22:03:29,528 |-INFO in ch.qos.logback.classic.net.SMTPAppender<span class="error">[null]</span> - About to send out SMTP message "Message1" to <span class="error">[nospam@qos.ch]</span><br/>
22:03:29,528 |-INFO in ch.qos.logback.classic.net.SMTPAppender<span class="error">[null]</span> - About to send out SMTP message "Message2" to <span class="error">[nospam@qos.ch]</span><br/>
subject=Message2<br/>
body=223 <span class="error">[main]</span> ERROR ? - Message2</p>
<p style='margin-top:0;margin-bottom:10px;'>subject=Message2<br/>
body=223 <span class="error">[main]</span> ERROR ? - Message2</p>
</div></div>
</td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Project:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<a style="color:#326ca6;" href="http://jira.qos.ch/browse/LOGBACK">logback</a>
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Priority:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<img src="http://jira.qos.ch/images/icons/priorities/major.png" height="16" width="16" border="0" align="absmiddle" alt="Major"> Major
</td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Reporter:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<a class="user-hover" rel="alexlumpov" id="email_alexlumpov" href="http://jira.qos.ch/secure/ViewProfile.jspa?name=alexlumpov" style="color:#326ca6;">Alex Lumpov</a>
</td>
</tr> </table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td><!-- End #email-page -->
</tr>
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
This message is automatically generated by JIRA.<br />
If you think it was sent incorrectly, please contact your JIRA administrators<br />
For more information on JIRA, see: <a style='color:#326ca6;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
</td>
</tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->