
Hi list, I just upgraded from logback-{core,classic} 1.0.0 to 1.0.2 and now whenever I start my application I see a message like this one: #logback.classic pattern: %msg%n in my logs. Like, really, it's literally logging the format string itself. Has a debug statement slipped in the 1.0.2 release? Here's the configuration of the app, in case you need it: <?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern> %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n </pattern> </encoder> </appender> <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>logs/access.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logs/access.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>1GB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <maxHistory>45<!-- days --></maxHistory> </rollingPolicy> <encoder> <pattern>%msg%n</pattern> </encoder> </appender> <logger name="access.log" additivity="false"> <appender-ref ref="ACCESS"/> </logger> <root level="info"> <appender-ref ref="STDOUT"/> </root> </configuration> When I start my app, before my main() starts, I see this on the STDOUT console logger: #logback.classic pattern: %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n And this gets added to my logs/access.log: #logback.classic pattern: %msg%n Thanks in advance. -- Benoit "tsuna" Sigoure Software Engineer @ www.StumbleUpon.com

On 05/02/2012 09:53 AM, tsuna wrote:
Hi list, I just upgraded from logback-{core,classic} 1.0.0 to 1.0.2 and now whenever I start my application I see a message like this one:
#logback.classic pattern: %msg%n
in my logs. Like, really, it's literally logging the format string itself. Has a debug statement slipped in the 1.0.2 release? Here's the configuration of the app, in case you need it:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern> %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n </pattern> </encoder> </appender>
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>logs/access.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logs/access.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>1GB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <maxHistory>45<!-- days --></maxHistory> </rollingPolicy> <encoder> <pattern>%msg%n</pattern> </encoder> </appender>
<logger name="access.log" additivity="false"> <appender-ref ref="ACCESS"/> </logger> <root level="info"> <appender-ref ref="STDOUT"/> </root> </configuration>
When I start my app, before my main() starts, I see this on the STDOUT console logger: #logback.classic pattern: %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n And this gets added to my logs/access.log: #logback.classic pattern: %msg%n
Thanks in advance.
As from the release note, this message was introduced by default in 1.0.2. Please try to add "<outputPatternAsPresentationHeader>false</outputPatternAsPresentationHeader>" to your <encoder> section (below the <pattern>) to avoid the message. cheers -andreas -- I can't influence text below here. This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

Hi Benoit, My response can be found below. On 02.05.2012 09:53, tsuna wrote:
Hi list, I just upgraded from logback-{core,classic} 1.0.0 to 1.0.2 and now whenever I start my application I see a message like this one:
#logback.classic pattern: %msg%n
in my logs. Like, really, it's literally logging the format string itself. Has a debug statement slipped in the 1.0.2 release? Here's the configuration of the app, in case you need it:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern> %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n </pattern> </encoder> </appender>
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>logs/access.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logs/access.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>1GB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <maxHistory>45<!-- days --></maxHistory> </rollingPolicy> <encoder> <pattern>%msg%n</pattern> </encoder> </appender>
<logger name="access.log" additivity="false"> <appender-ref ref="ACCESS"/> </logger> <root level="info"> <appender-ref ref="STDOUT"/> </root> </configuration>
When I start my app, before my main() starts, I see this on the STDOUT console logger: #logback.classic pattern: %d{ISO8601} %-5level [%thread] %logger{0}: %msg%n
This can be fixed by telling the PatternLayout not to print the output pattern string as a header. Here is the modified ConsoleAppender definition. <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{ISO8601} %-5level [%thread] %logger{0}: %msg%n</pattern> <-- do not print pattern as a header --> <outputPatternAsPresentationHeader> false </outputPatternAsPresentationHeader> </encoder> </appender>
And this gets added to my logs/access.log: #logback.classic pattern: %msg%n
Here is the modified RollingFileAppender defintion: <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>access.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>access.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>1GB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <maxHistory>45<!-- days --></maxHistory> </rollingPolicy> <encoder> <pattern>%msg%n</pattern> <-- do not print pattern as a header --> <outputPatternAsPresentationHeader> false </outputPatternAsPresentationHeader> </encoder> </appender> HTH, -- Ceki http://twitter.com/#!/ceki

Thanks all. My bad for not reading the release notes. I generally read them but got lazy with logback given that the releases generally haven't introduced any surprises for … for ever since I use logback, which is about 2 years now. I gave my vote on LBCORE-234 to disable this feature by default. I understand how this feature can be useful, but I'm not sure how to justify breaking the logs by introducing this extra line, especially in a minor release. -- Benoit "tsuna" Sigoure Software Engineer @ www.StumbleUpon.com

On 2 May 2012 09:43, tsuna <tsunanet@gmail.com> wrote:
I gave my vote on LBCORE-234 to disable this feature by default. I understand how this feature can be useful, but I'm not sure how to justify breaking the logs by introducing this extra line, especially in a minor release.
I agree ... Greg

Hi all, I created a one question survey to take the pulse of the community. Here is the link: http://patternasheader.questionpro.com/ -- Ceki http://twitter.com/#!/ceki On 02.05.2012 11:13, Greg Thomas wrote:
On 2 May 2012 09:43, tsuna <tsunanet@gmail.com <mailto:tsunanet@gmail.com>> wrote:
I gave my vote on LBCORE-234 to disable this feature by default. I understand how this feature can be useful, but I'm not sure how to justify breaking the logs by introducing this extra line, especially in a minor release.
I agree ...
Greg

On 02.05.2012 15:49, ceki wrote:
Hi all,
I created a one question survey to take the pulse of the community. Here is the link:
FYI Question: By default, should PatternLayout print its pattern at the top of log files? Results of the survey so far (31 persons replied): yes: 25.81% no: 61.29% no opinion: 12.90% It looks like there is a clear majority for *not* printing header info by default. -- Ceki http://twitter.com/#!/ceki
participants (4)
-
Andreas Kruthoff
-
ceki
-
Greg Thomas
-
tsuna