Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fine-tune the level for SonarQube Gradle plugin

I'm using SonarQube plugin (version 2.6.1) for Gradle (version 4.7) and have the problem that a lot of unimportant log output is being written while running the sonar analysis on my CI server.

Is there a way to fine-tune the log level for this plugin?

I checked the documentation but the only setting related to the log output I found was the JVM argument "verbose" which I'm not using either way (I guess the default is false so this shouldn't be turned on for me).

EDIT: Here are some examples of the output I would like to get rid of:

  1. Some huge exception stacktraces during findbugs analysis (this one is shortened, didn't want to post the whole stacktrace, it's really huge).
16:23:34.993 ERROR - Unable to create symbol table for : /opt/workspace/pipeline-1/src/main/java/com/SomeClass.java
java.lang.NullPointerException: null
    at org.sonar.java.resolve.TypeAndReferenceSolver.getSymbolOfMemberSelectExpression(TypeAndReferenceSolver.java:232) ~[java-squid-2.5.1.jar:na]
    at org.sonar.java.resolve.TypeAndReferenceSolver.resolveAs(TypeAndReferenceSolver.java:200) ~[java-squid-2.5.1.jar:na]
    at org.sonar.java.resolve.TypeAndReferenceSolver.resolveAs(TypeAndReferenceSolver.java:182) ~[java-squid-2.5.1.jar:na]
    at...
  1. Stacktraces from PMD:
16:23:37.206 ERROR - Fail to execute PMD. Following file is ignored: /opt/workspace/pipeline-1/src/main/java/com/SomeClass.java
java.lang.RuntimeException: null
    at org.objectweb.asm.MethodVisitor.visitParameter(Unknown Source) ~[asm-5.0.3.jar:5.0.3]
    at org.objectweb.asm.ClassReader.b(Unknown Source) ~[asm-5.0.3.jar:5.0.3]
    at org.objectweb.asm.ClassReader.accept(Unknown Source) ~[asm-5.0.3.jar:5.0.3]
    at org.objectweb.asm.ClassReader.accept(Unknown Source) ~[asm-5.0.3.jar:5.0.3]
    at net.sourceforge.pmd.lang.java.typeresolution.PMDASMClassLoader.getImportedClasses(PMDASMClassLoader.java:77) ~[pmd-java-5.2.1.jar:na]...
  1. Lots of irrelevant warnings like these:
16:23:38.638 WARN  - /opt/workspace/pipeline-1/src/main/java/com/SomeClass.java: Got an exception - expecting EOF, found '}'
/opt/workspace/pipeline-1/src/main/java/com/SomeClass.java:28:5: expecting RCURLY, found 'default'
16:23:38.655 WARN  - /opt/workspace/pipeline-1/src/main/java/com/SomeClass.java: Got an exception - expecting EOF, found 'someVariable'

I don't know what exactly is causing these problems, but since both my app and the results of the sonar analysis are looking OK, I would like to get rid of those log outputs since they only pollute my logs on Jenkins and make them unreadable.

like image 317
Marko Previsic Avatar asked Nov 07 '22 17:11

Marko Previsic


1 Answers

There's property sonar.log.level and sonar.verbose; for example:

allprojects {
    sonarqube {
        properties {
            // property "sonar.log.level", "INFO"
            property "sonar.log.level", "TRACE"
        }
    }
}

see the analysis parameters.

like image 76
Martin Zeitler Avatar answered Nov 15 '22 11:11

Martin Zeitler