Skip to content

Rethink slf4j packaging #8

Open
@norbertroamsys

Description

@norbertroamsys

Hello ipdata team,

We have a build problem regarding the usage of your library: ipdata uses the "Simple Logging Facade for Java (SLF4J)" for encapsulating logging. This is of course fine to be flexible for using different logging framework.

But the "unwanted" thing is that ipdata has a direct dependency to slf4j-log4j12 (Log4J). We do not use Log4j and had to exclude this dependency in pom.xml:

        <dependency>
            <groupId>co.ipdata.client</groupId>
            <artifactId>ipdata-java-client</artifactId>
            <version>0.2.0</version>
            <exclusions>
                <!-- Exclude Log4J binding because slf4j-jdk14 is defined in project -->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Please refer to the slf4j documentation:

Embedded components such as libraries or frameworks should not declare a dependency on any SLF4J binding but only depend on slf4j-api. When a library declares a compile-time dependency on a SLF4J binding, it imposes that binding on the end-user, thus negating SLF4J's purpose. When you come across an embedded component declaring a compile-time dependency on any SLF4J binding, please take the time to contact the authors of said component/library and kindly ask them to mend their ways.

Can you please investigate whether to leave out this dependency?
In our opinion this can be done backward compatible: If slf4j doesn't find a logger implementation it will fallback to the no-operation logger and will trace out the following warning:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Thank's for your support!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions