Skip to content

Allow spring-jcl to be found by Commons Logging's service discovery [SPR-16585] #21127

Closed

Description

@spring-projects-issues

Andy Wilkinson opened SPR-16585 and commented

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?


Affects: 5.0.4

Reference URL: spring-projects/spring-boot#12457

Issue Links:

Referenced from: commits 0b86c71, 31bfc1d

1 votes, 5 watchers

Activity

  1. spring-projects-issues commented on May 4, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Andy Wilkinson commented

    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?

  2. spring-projects-issues commented on May 5, 2018

    @spring-projects-issues
    CollaboratorAuthor

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

  3. spring-projects-issues commented on Jul 3, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    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.

  4. added
    type: enhancement
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions