vy commented on issue #2720:
URL: 
https://github.com/apache/logging-log4j2/issues/2720#issuecomment-2215111164

   @blaghed, good news is, you don't need to deal with _the mailing list 
stuff_. We would be more than happy to assist you here.
   
   Can you explain what kind of a cache you see others implement (references 
please) and `log4j-slf4j-impl` is missing? That is, to create a `Logger`, we 
need a `LoggerContext`. To locate that, we need to know the enclosing class of 
the `getLogger()` call, and this is where `StackLocatorUtil.getCallerClass()` 
comes in.
   
   > Following the change of heart on 
[slf4j#declared_static](https://slf4j.org/faq.html#declared_static)...
   
   IMHO, you're misinterpreting the docs. It says `instance variables`. Your 
example is not an instance variable, but a `method variable`. This is an 
instance variable:
   
   ```
   public class MyApp {
       // Note the missing `static` modifier
       private final String foo = "bar";
   }
   ```
   
   Generally speaking, `Logger`s are not cheap constructs, they should ideally 
be reused and kept in a sufficiently long-living scope.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to