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

Abraham Lin abraham.lin at post.harvard.edu
Mon Jun 24 16:33:24 CEST 2013


There's an existing JIRA issue on this:
http://jira.qos.ch/browse/LOGBACK-865


On Mon, Jun 24, 2013 at 9:31 AM, Mads Bondo Dydensborg <mbd at dbc.dk> wrote:

> **
>
> The stmp standard dictates that a header field is terminated by a new
> line. An empty line terminates the list of header fields.
>
>
>
> The relevante info is in 3.1.3 of the 822 RC, I guess:
>
>
>
> 3.1.3. UNSTRUCTURED FIELD BODIES
>
>
>         For some fields, such as "Subject" and "Comments",  no  struc-
>
>         turing  is assumed, and they are treated simply as <text>s, as
>
>         in the message body.  Rules of folding apply to these  fields,
>
>         so  that  such  field  bodies  which occupy several lines must
>
>         therefore have the second and successive lines indented by  at
>
>         least one LWSP-char.
>
>
> So, it looks like a bug in the SMTP appender or some software it uses.
>
>
> Regards
>
>
> Mads
>
>
>
> Mandag 24 juni 2013 13:00:46 skrev Arend v. Reinersdorff:
>
> 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--
>
>
>
>
> --
>
> Med venlig hilsen/Regards
>
>
>
> Chefarkitekt/Chief Architect cand.scient.dat, Ph.d., Mads Bondo Dydensborg
>
> Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 29 84
> 00 42
>
>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130624/9b4ba4b9/attachment-0001.html>


More information about the Logback-user mailing list