Don't obtrude a logging framework (conflicts)

Issue #37 resolved
Christian Schudt
created an issue

I am using JXLS in my application as well as org.slf4j. As SLF4Jimplementation we are using Log4j.

Since you are using another logging implementation, namely ch.qos.logback:logback-classic:1.1.3, I get these errors by SLF4J:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/csh/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/csh/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.4.1/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

I am not sure, what I can do, that I can use Log4j (along with my logging configuration), but in general I am suggesting to only code against the SLF4J API and let users of your library decide which logging framework they want to use.

(I've seen you use ch.qos.logback extensively in your code, so I am not sure this issue is feasible at all.)

Comments (8)

  1. leonate NA repo owner

    The problem is that jxls uses logback XML framework for XML builder implementation.

    And the framework is built in into logback-core so there is a need to have such a dependency.

    I'll need to think how to deal with this SLF4j multiple binding issue.

    Possibly the only option would be to rewrite this piece of code to use some other framework for XML processing.

  2. Christian Schudt reporter

    I don't know why you need XML (or what the XML builder does), but usually if I work with XML my choice is nearly always JAXB and other classes from the javax.xml package (e.g XMLStreamReader) , since it's standard and built into the JDK.

  3. leonate NA repo owner

    XML Builder performs similar functions as XLS Comment builder but it builds Jxls command-area structure dynamically from XML file instead of from excel comments.

    JAXB is not a very good fit for this for several reasons and will require much more code to write to implement similar functionality.

    In the jxls 1.x I have used Apache Digester for similar purpose but in jxls 2.x I found that logback xml api is even simpler to use and more lightweight.

    I will think about this issue when I have some more time.

  4. leonate NA repo owner

    I have replaced logback-classic dependency with a dependency to logback-core. In my tests it resolves the issue. But if you still has a problem please let me know.

  5. Log in to comment