You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow spring-jcl to be found by Commons Logging's service discovery [SPR-16585] #21127
I've just learned about a useful behaviour of jcl-over-slf4j which allows it to work even when the Commons Logging jar has got onto the classpath somehow.
jcl-over-slf4j contains a META-INF/services/org.apache.commons.logging.LogFactory file which means that it's found by Commons Logging's standard discovery mechanism. spring-jcl has no such file. As a result, when Commons Logging is on the classpath and is being used, it falls back to its default factory and creates Jdk14Logger instances.
Would it be possible for spring-jcl to provide a META-INF/services/org.apache.commons.logging.LogFactory so that it's a better jcl-over-slf4j replacement and continues to work even when Commons Logging is on the classpath?
The current behaviour of spring-jcl is continuing to cause problems for Spring Boot users. This issue is the latest example. Arguably, this is a regression from Spring Boot 1.5, but, without dropping spring-jcl, fixing it is out of our control. Could a fix for this issue please be considered in Framework 5.0.x?
On reconsideration, I'm afraid this has to remain a Spring Framework 5.1 topic since it requires quite some refactoring and specific adaptation to the standard Commons Logging LogFactory implementation, whereas we currently fully replace that class and don't have to deal with the peculiarities of its default implementation at all.
I'd rather have such a major revision going through the 5.1 RC phase which isn't far away. There is a clean workaround for the time being - exclusion of standard commons-logging - which will remain the recommended solution in any case since a clean classpath is always preferable to messy Commons Logging service discovery with overlapping packages.
Of course, ideally, those remaining few cases that drag in the commons-logging artifact should simply go away. Could we get in touch with those project maintainers to get rid of their their hard dependency there, or otherwise include them in Boot's dependency management with a hard commons-logging exclusion on our side?
I've refactored spring-jcl to provide a LogFactoryService class now, suitable as a subclass for the standard Commons Logging LogFactory implementation and its service discovery mechanism. In combination with a corresponding META-INF entry, this works fine for me locally when commons-logging comes first on the classpath, nevertheless delegating to our new LogDelegate underneath. In regular spring-jcl scenarios, that delegate is called directly from our LogFactory replacement, providing the same efficiency as before.
Activity
spring-projects-issues commentedon May 4, 2018
Andy Wilkinson commented
The current behaviour of
spring-jclis continuing to cause problems for Spring Boot users. This issue is the latest example. Arguably, this is a regression from Spring Boot 1.5, but, without droppingspring-jcl, fixing it is out of our control. Could a fix for this issue please be considered in Framework 5.0.x?spring-projects-issues commentedon May 5, 2018
Juergen Hoeller commented
On reconsideration, I'm afraid this has to remain a Spring Framework 5.1 topic since it requires quite some refactoring and specific adaptation to the standard Commons Logging
LogFactoryimplementation, whereas we currently fully replace that class and don't have to deal with the peculiarities of its default implementation at all.I'd rather have such a major revision going through the 5.1 RC phase which isn't far away. There is a clean workaround for the time being - exclusion of standard
commons-logging- which will remain the recommended solution in any case since a clean classpath is always preferable to messy Commons Logging service discovery with overlapping packages.Of course, ideally, those remaining few cases that drag in the
commons-loggingartifact should simply go away. Could we get in touch with those project maintainers to get rid of their their hard dependency there, or otherwise include them in Boot's dependency management with a hardcommons-loggingexclusion on our side?spring-projects-issues commentedon Jul 3, 2018
Juergen Hoeller commented
I've refactored
spring-jclto provide aLogFactoryServiceclass now, suitable as a subclass for the standard Commons LoggingLogFactoryimplementation and its service discovery mechanism. In combination with a corresponding META-INF entry, this works fine for me locally whencommons-loggingcomes first on the classpath, nevertheless delegating to our newLogDelegateunderneath. In regularspring-jclscenarios, that delegate is called directly from ourLogFactoryreplacement, providing the same efficiency as before.