How to set log level when running Gauge tests via Maven plugin
Asked Answered
W

2

8

When running my Gauge tests via mvn gauge:execute -DspecsDir=specs the console output is polluted with DEBUG output.

16:33:46.950 [main] DEBUG org.reflections.Reflections - could not scan file META-INF/MANIFEST.MF ...
16:33:46.951 [main] DEBUG org.reflections.Reflections - could not scan file META-INF/MANIFEST.MF ...
16:33:46.951 [main] DEBUG org.reflections.Reflections - could not scan file META-INF/maven/net.minidev/json-smart/pom.properties ...
...
16:35:52.676 [Thread-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request PUT ...
16:35:52.676 [Thread-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
16:35:52.676 [Thread-1] DEBUG org.apache.http.headers - http-outgoing-0 >> PUT ...

How can I set the log level for these tests (when running them via Maven plugin)?

Woodworking answered 5/10, 2017 at 14:49 Comment(0)
U
5

You can give to JVM these Opts

mvn gauge:execute -DspecsDir=specs -Dorg.slf4j.simpleLogger.defaultLogLevel=warn

mvn gauge:execute -DspecsDir=specs -Dorg.slf4j.simpleLogger.defaultLogLevel=warn

Or use quite mode

mvn gauge:execute -q -DspecsDir=specs

or

mvn gauge:execute -Dflags="--verbose=false,--log-level=warn" -DspecsDir=specs
Unrest answered 9/10, 2017 at 5:30 Comment(2)
Neither of the thrre commands above work for me. I still see the DEBUGoutput.Woodworking
try the last option (updated now) should work, donno how you are invoking the maven goal,Unrest
A
2

This seems to relate to MNG-6181 which has been fixed in version 3.5.0 of Maven. So if you're not on the latest version as of now, you can upgrade the Maven version to make use of the fix.


In case you want to manipulate the logging option for all your Maven builds with existing version(3.1 or above), you can try to modify its logger implementation at the file:

${MAVEN_HOME}/conf/logging/simplelogger.properties

e.g. On MacOSX, it would be somewhat like-

vi /usr/local/Cellar/maven/3.5.0/libexec/conf/logging/simplelogger.properties

and then make sure that the properties include something like these:-

org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=off
org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient.wire=off

Alternatively, you can execute your mvn command with the quiet option to filter out only Error logs. The updated command to be used would be:-

mvn gauge:execute -DspecsDir=specs -q
Ataxia answered 11/10, 2017 at 1:20 Comment(2)
by changing the simple logger properties in maveen, it will disable logging global level ( for all maven projects not specific one),Unrest
@RamiReddyPalamakula True and that is specified in the answer as well. ... all your Maven buildsAtaxia

© 2022 - 2024 — McMap. All rights reserved.