dfa1 commented on pull request #770:
URL: https://github.com/apache/logging-log4j2/pull/770#issuecomment-1079376882


   @rgoers tried also your last suggestion too:
   
   > You are free to use ServiceLoader to locate the SLF4J Service Provider and 
get the Marker factory and then create Markers to your hearts content." 
   
   but unfortunately it is sensitive to classpath order since SLF4J is picking 
up the first provider: 
   
   ```java
   List<SLF4JServiceProvider> providersList = findServiceProviders();
   reportMultipleBindingAmbiguity(providersList);
   if (providersList != null && !providersList.isEmpty()) {
       PROVIDER = providersList.get(0); <-- only the first one is considered
       // SLF4JServiceProvider.initialize() is intended to be called here and 
nowhere else.
       PROVIDER.initialize();
   ```
   
   so far, my workaround is to provide my JAR with my custom layout 
implementation *before* any other jar in the classpath (this is done for about 
20 Dockerfiles, it feels really dirty). 


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