[logback-dev] [JIRA] Commented: (LBCLASSIC-232) %n is necessary to separate real message from exception stack trace

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Tue Nov 9 21:59:51 CET 2010


    [ http://jira.qos.ch/browse/LBCLASSIC-232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11888#action_11888 ] 

Ceki Gulcu commented on LBCLASSIC-232:
--------------------------------------

Are you aware of the fact that the %xException conversion word is automatically added to all patterns missing a conversion word handling exceptions?

> %n is necessary to separate real message from exception stack trace
> -------------------------------------------------------------------
>
>                 Key: LBCLASSIC-232
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-232
>             Project: logback-classic
>          Issue Type: Bug
>          Components: layout
>    Affects Versions: 0.9.26
>            Reporter: Michael Osipov
>            Assignee: Logback dev list
>
> I started using the SMTPAppender and defined this pattern layout:
> <Pattern>Zeitstempel: %date%(%n)Kontext: %contextName%(%n)Angeforderte URI: %X{req.requestURI}%(%n)QueryString: %X{req.queryString}%(%n)Nachricht: %msg</Pattern>
> I do receive single log messages only so I don't need a %n at the end. Unfortunately, my log messages are messed up.
> Instead of:
> Nachricht: <msg>
> <ex>
> as the default log layout, I get:
> Nachricht: <msg><ex>
> I added a %n and it solved the problem. I was able to reproduce this with the FileAppender but this behavior make no sense. The exception is part of the message and should always include a \n internally unless a %ex is exlicitly defined. The last %n includes two line feed at once.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list