Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logback - no end of line delimiter

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 the pattern set right AFAIK:

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

What's the catch?

like image 599
Rostislav Matl Avatar asked May 31 '10 15:05

Rostislav Matl


2 Answers

Found it, the 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>
like image 161
Rostislav Matl Avatar answered Nov 01 '22 14:11

Rostislav Matl


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

They need to be escaped with a backslash.

like image 45
Ceki Avatar answered Nov 01 '22 13:11

Ceki