Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cobertura 2.1.1 uses slf4j binding logback-classic #36

Open
nomis opened this issue Jun 28, 2017 · 3 comments
Open

Cobertura 2.1.1 uses slf4j binding logback-classic #36

nomis opened this issue Jun 28, 2017 · 3 comments

Comments

@nomis
Copy link

nomis commented Jun 28, 2017

Cobertura 2.1.1 uses the slf4j binding logback-classic, which causes problems when the project has a different slf4j binding:

[INFO] --- cobertura-maven-plugin:2.7:instrument (report:cobertura) @ lightswitch-android ---
[INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Cobertura: Saved information on 10 classes.
[INFO] Cobertura: Saved information on 10 classes.

[ERROR] SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/mnt/ssd/m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/mnt/ssd/m2/repository/eu/lp0/slf4j/slf4j-android/1.7.12-0/slf4j-android-1.7.12-0.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]

This binding should be removed, leaving only slf4j-api.

Please DO NOT propose workarounds, those are in the closed issue #6.

@nomis
Copy link
Author

nomis commented Jun 28, 2017

I can exclude logback-classic from the cobertura dependency but then I run into other problems because there's then no slf4j binding when the test projects are run.

If I skip the tests it then fails to run on my project because the slf4j binding it uses only works on Android platforms. It looks like Cobertura either needs to stop using slf4j or Maven needs to segregate the plugin dependencies from the project dependencies.

@adrshsrvstv
Copy link

Is there any solution to this issue at all?

msiemczyk added a commit to msiemczyk/cobertura that referenced this issue Jul 19, 2018
…ndency.

- Updated Java version to 1.7.
- Restructured Maven projects in order to create easy to consume "cobertura.jar" Core Library.
- Moved web (coberturaFlush.war) files to it's own module, called cobertura-flush-war. This project build war package and contains only servlet class, test classes, and needed web.xml configuration.
- Moved final stand-alone tool creation to new cobertura-assembly module.  This maven (pom) project is only responsible for building tool's packge (in zip, tar, etc. format) that includes Cobertura Core library, Cobertura Flush Servlet WAR, and all needed dependencies as well as scripts, examples and (logback) logging configuration.
- Re-factored pom.xml to proper structure and inheritance.

Cobertura 2.1.1 uses slf4j binding logback-classic cobertura#36
mojohaus/cobertura-maven-plugin#36
msiemczyk added a commit to msiemczyk/cobertura-maven-plugin that referenced this issue Jul 20, 2018
These changes require corresponding changes in coberura.

- Changed Cobertura logging configuration file to logback and included logback SLF4J binding for runtime scope. The use of logback was not really necessary and Log4J would of worked to as long as binding library is provided. I chose logback to be consitent with how Cobertura stand-alone tool works.
- Updated the necessary code to use the new configuration file.
- Updated maven requirements to 3.3.1
- Partial update of maven API versions to 3.x (mojohaus#32 Update to maven 3 apis )

- Cobertura-plugin 2.7 modifies the build's log4j configuration

mojohaus#36
mojohaus#32
mojohaus#14
msiemczyk added a commit to msiemczyk/cobertura-maven-plugin that referenced this issue Jul 21, 2018
More changes related to maven API versions to 3.x that fix unit and integration tests. The actual production code still needs to be adapted to 3.x API.

mojohaus#32 Update to maven 3 apis
@ct-parker
Copy link

Just to add some context to how important fixing this bug is, there is a StackOverflow question illustrating that Cobertura 2.1.1 forces wire logging for Apache Commons HttpClient, which can easily cripple a Jenkins server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants