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

Michael Osipov (JIRA) noreply-jira at qos.ch
Mon Nov 8 14:27:51 CET 2010


%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