Matt Sicker ha scritto il 09/01/19 alle 17:26:
On Wed, 9 Jan 2019 at 06:05, Federico Fissore <feder...@fissore.org> wrote:
...
its cost is not zero, as it creates a new object instance every time
error/info/xxx methods are called, ...

Wouldn't escape analysis eventually cause inlining anyways? Garbage
may not be too big an issue there, especially since you've already got
null loggers for when it's disabled (though if you cache the level
logger like you suggested, then any reconfiguration of logging will
not be reflected).

JIT has a chance to optimize that code so that, when logging is disabled, resulting code is just the "if ifXXXEnabled".

And yeah, caching would turn to even faster code for disabled loggers, but would also ignore configuration changes, which is something a slf4j user would not expect


Also, does this still work when caller location information is enabled
in log4j2 or logback?


Can you define "caller location information"? I'm missing that

federico
_______________________________________________
slf4j-user mailing list
slf4j-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/slf4j-user

Reply via email to