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

   The idea behind instance loggers is a nice one: if an application server 
shares your library between applications, instance loggers should allow you to 
log messages to the correct application's log file.
   
   Unfortunately **many** (most?) libraries don't use instance loggers and the 
list also includes libraries, which are **meant to be shared** between 
applications.
   For example Hibernate's 
[`EntityManagerImpl`](https://github.com/manuelbernhardt/hibernate-core/blob/master/hibernate-entitymanager/src/main/java/org/hibernate/ejb/EntityManagerImpl.java)
 and 
[`SessionFactoryImpl`](https://github.com/manuelbernhardt/hibernate-core/blob/master/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java),
 which are objects specific to each application, use **static** loggers and 
send the logs of all applications to server's global logger context.
   
   Since Hibernate is the JPA implementation in many application servers, 
system administrators are used to the fact that logs specific to a given 
application are scattered among multiple log files.
   Therefore they have no reason to configure per-application logger contexts 
and might as well use a single logger context.
   
   Note also that SLF4J's standard implementation (Logback) only supports a 
single logger context (see 
[`LoggerContext`](https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java)).
   
   **Remark**: I chose Hibernate as an example. Pick any implementation of a 
Jakarta specification and you'll find similar problems.
   


-- 
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