which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
We are using an on premis Sonarqube instance developer edition version 7.9.1 in combination with
Azure pipelines on microsofts azure enviroment. With the following Azure tasks:
Prepare Analysis Configuration (version 4.8.0)
Run Code Analysis (version 4.8.0)
Publish Quality Gate Result (version 4.8.1)
and it uses
SonarScanner for MSBuild (version 4.7.1)
What are you trying to achieve
We are using Sonar in combination with PR controle in a classic CI/CD strategy. So we want to check our C# code to be checked by a PR.
Everything goes well. The analyses comes to an end and we see the results both in Sonar and in Azure. But in the process of running the code analysis we get the following error:
##[error]SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Class path contains multiple SLF4J bindings.
##[error]SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/a1c05423113146c25aa5a0819888ceec/sonar-scanner-engine-shaded-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/d24ab21450b3b6d61e6868e70eb27a46/scanner-developer-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/a1c05423113146c25aa5a0819888ceec/sonar-scanner-engine-shaded-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/<Username>/.sonar/cache/d24ab21450b3b6d61e6868e70eb27a46/scanner-developer-7.9.1-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
##[error]SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
We want to get rid of this error because it’s distracting and gives a bunch of red lines in Azure.
But we don’t know how.
Hi @dmeneses
I have the same issue, and since updating to version 8, none of our metrics have worked.
INFO: Scanner configuration file: D:\agent6_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\sonar-scanner-4.1.0.1829\bin…\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\agent6_work\1.sonarqube\out\sonar-project.properties
INFO: SonarQube Scanner 4.1.0.1829
INFO: Java 1.8.0_181 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: User cache: C:\Windows\ServiceProfiles\NetworkService.sonar\cache
INFO: SonarQube server 8.0.0
INFO: Default locale: “en_GB”, source code encoding: “windows-1252” (analysis is platform dependent)
##[error]SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/6abbcd30a9bf1fba1794eb6ce16eb36f/scanner-developer-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
##[error]SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Found binding in [jar:file:/C:/Windows/ServiceProfiles/NetworkService/.sonar/cache/9f2b37948b00b865aaf57dfd335e8d6a/sonar-scanner-engine-shaded-8.0-all.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
##[error]SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
Hi,
The errors in the logs shouldn’t have any effect on metrics. What exactly is the problem you have with metrics?
Could you show the scanner logs with debug enabled?
The errors may or may not have any effect on the metrics. The effect is on trust for your tool. Integrated into Azure DevOps, when we build projects, we see blood on the screen. Seeing these errors creates the cracked windows situation. People get used to seeing so much red that they begin to distrust the “quality” tool.
I’m asking for help here to know how to get SonarQube to use the right binding for SLF4J and not display any more of those errors in every build we run. I’m sure you can appreciate how unsightly it looks.
No one is challenging the fact that seeing error logs is not good.
When investigating the problem, it obviously matters if metrics are affected or not because that would lead us to a completely different direction.
We only know if the logs in debug make a difference or not once they are posted. It often does make a difference when it comes to problems in the scanner side, hence me requesting it.
Could you please check what files you have in sonarqube_server_home/lib/scanner? Did you upgrade the server installation from Community Edition to Developer Edition at some point?
I suspect that a file was left over from an upgrade and there are 2 files: sonar-scanner-engine-shaded-8.0-all.jar and scanner-developer-8.0-all.jar.
If that’s the case, please delete sonar-scanner-engine-shaded-8.0-all.jar and restart the server.
Thanks for your response. This is a fresh install of version 8 developer edition. The database was upgraded from version 7.9 developer edition. I can check the contents of that folder tomorrow.
I guess my frustration is that I am not the only one experiencing it and there seems to be no attention given to this issue.