sfleiter/cdi-interceptors

Usage of uk.org.lidalia.slf4jext causes Logback to resolve wrong class name and line

sfleiter opened this issue · 1 comments

SomeClass [Level.java : 128] call someMethod() returns null [duration=5ms]

See LoggingEvent.getCallerData()
and LoggerContext.getFrameworkPackages().

Possible solution for logback:

  • add a LoggerContextListener and implement onStart()
  • call LoggerContext.getFrameworkPackages().add(Level.getClass().getPackage().getName())
  • adjust logback config as described here

Same problem probably exists for other logging frameworks.

Because of CDI Proxies it will probably never be possible to get log frameworks to show correct file and line number information.
What should be avoided is that log frameworks show slf4jext classes as source of log calls.