开发者

logback - no end of line delimiter

开发者 https://www.devze.com 2023-01-01 22:17 出处:网络
I\'m using logback 0.9.21 . Unfortunately it prints all messages to single line, there is no end of line character, even wrong one.

I'm using logback 0.9.21 . Unfortunately it prints all messages to single line, there is no end of line character, even wrong one.

I've got th开发者_JAVA技巧e pattern set right AFAIK:

<pattern>%d{HH:mm:ss.SSS} %-5level %class (%thread) [%logger{36}] -- %msg%n</pattern>

What's the catch?


Found it, round brackets have special meaning in the pattern layout, therefore they must be escaped. So the pattern should look this way:

<pattern>%d{HH:mm:ss.SSS} %-5level %class \(%thread\) [%logger{36}] -- %msg%n</pattern>


In logback, parentheses within the pattern string serve as grouping tokens.

They need to be escaped with a backslash.


For any troubled soul like my self, Logback behave this way when it found a miss match token, not just parenthesis,

in my case was a miss placed :- token

0

精彩评论

暂无评论...
验证码 换一张
取 消