LumnitzF opened a new issue, #1876:
URL: https://github.com/apache/logging-log4j2/issues/1876

   ## Description
   
   When updating Log4j to 2.21.0 the JCL bridge is not working correctly 
anymore.
   See the following code snippet:
   ```
   import org.apache.commons.logging.LogFactory;
   
   public class Main {
   
       public static void main(String[] args) {
           System.out.println(LogFactory.getFactory().getClass());
           System.out.println(LogFactory.getLog(Main.class).getClass());
       }
   }
   ```
   
   With 2.20.0 it prints:
   > class org.apache.logging.log4j.jcl.LogFactoryImpl
   > class org.apache.logging.log4j.jcl.Log4jLog
   
   With 2.21.0 it prints:
   > class org.apache.commons.logging.impl.LogFactoryImpl
   > class org.apache.commons.logging.impl.Jdk14Logger
   
   The underlying problem seems to be, that the 
`org.apache.commons.logging.LogFactory` does not correctly read the factory 
class from the "META-INF/services/org.apache.commons.logging.LogFactory" from 
the JCL module. It only reads the first line: 
https://github.com/apache/commons-logging/blob/bd26f32b9a24e1c5176da719c95203bba09e401c/src/main/java/org/apache/commons/logging/LogFactory.java#L542
   Since 2.21.0 the first line is not the factory class anymore, but `# 
Generated by bnd`. Thus the jcl factory is never selected.
   
   ## Configuration
   
   **Version:** 2.21.0
   
   **Operating system:** Windows 10
   
   **JDK:** OpenJDK Runtime Environment Temurin-17.0.8.1+1 (build 17.0.8.1+1)
   
   ## Logs
   
   
   ## Reproduction
   
   See the example code. No special configuration is necessary.
   


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