[logback-user] SMTPAppender - Email not formatted properly when log message contains double linebreak

Arend v. Reinersdorff arend at arendvr.com
Mon Jun 24 13:00:46 CEST 2013


Hi,

when I a log message with a double linebreak "A\n\nA" to SMTPAppender, the
resulting Email is not formatted properly.

The MIME parts are not parsed but are display as the message body. It looks
like the double linebreak is written directly into the Subject-Header.

With a single linebreak I get the same problem in Gmail. In Outlook the
email is formatted properly, only the subject is cut at the linebreak.

Could this be a bug in Logback?

Regards,
Arend


Logging call:
LoggerFactory.getLogger(Main.class).error("A\n\nA");


logback.xml:
<configuration>
    <root>
        <appender class="ch.qos.logback.classic.net.SMTPAppender">
            <smtpHost>... smtpHost</smtpHost>
            <to>... email</to>
            <subject>%logger{10} - %message</subject>
            <layout class="ch.qos.logback.classic.PatternLayout">
                <pattern>%logger{10} - %message</pattern>
            </layout>
        </appender>
    </root>
</configuration>



Email subject:
c.e.l.Main - A


Visible email body:
A
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="----=_Part_0_14393847.1372070958822"

------=_Part_0_14393847.1372070958822
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

c.e.l.Main - A
A
------=_Part_0_14393847.1372070958822--

Email source:
... email headers
To: ...
Message-ID: ...
Subject: c.e.l.Main - A

A
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="----=_Part_0_14393847.1372070958822"

------=_Part_0_14393847.1372070958822
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

c.e.l.Main - A
A
------=_Part_0_14393847.1372070958822--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130624/cfd36e4d/attachment.html>


More information about the Logback-user mailing list