Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)?

like image 938
benny.la Avatar asked Oct 05 '17 14:10

benny.la


2 Answers

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
like image 68
RamiReddy P Avatar answered Nov 15 '22 17:11

RamiReddy P


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
like image 42
Naman Avatar answered Nov 15 '22 16:11

Naman