[slf4j-user] RFC: slf4j-fluent

Federico Fissore federico at fissore.org
Thu Jan 10 08:59:24 CET 2019


Matt Sicker ha scritto il 09/01/19 alle 17:26:
> On Wed, 9 Jan 2019 at 06:05, Federico Fissore <federico at 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


More information about the slf4j-user mailing list