Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logback pattern prints [jar] after message

I have a strange logs from logback. All messages (each row) followed by [jar name] like this:

 13:19:45 ERROR [c.o.s.w.s.Class] lalalalal [module-version.jar]

The pattern is:

<pattern>%d{HH:mm:ss,SSS} %-5p [%c{3}] %m%n</pattern>

I've searched on logback site but didn't find anything. This suffix is messing stacktrace so how can I hide it?

P.S. Sorry for my english:)

like image 720
Edd Avatar asked Jan 15 '23 12:01

Edd


2 Answers

It is indeed a feature as others have noted. However, if needed, it can be disabled.

You can disable it by adding %ex at the end of the pattern, so %d %logger - %m%n should be rewritten as %d %logger - %m%n%ex. In your case, I think this should be the correct form, if you want to disable it:

<pattern>%d{HH:mm:ss,SSS} %-5p [%c{3}] %m%n%ex</pattern>

This might be even needed for some situations where this information causes siginificant overhead, although I would personally leave it on and rather change the environment or the IDE.

EDIT: and yes, the %exis documented.

like image 136
eis Avatar answered Jan 25 '23 06:01

eis


That's a feature. In case of errors logback gives you the exact name of the jar from which the error originates, which may be useful to diagnose classpath problems. You can read more about it here

like image 29
Nicola Musatti Avatar answered Jan 25 '23 06:01

Nicola Musatti