Closed ljohnston closed 8 years ago
I think it's a combination of the two. The test runner reports its progress to standard out, and it looks as though you have configured your logging to do the same.
You can run Gradle in quiet mode with --quiet
but that will silence the other tasks too.
You can set the logging mode of the test
task, but that will silence the reporting of test progress.
You might configure your logging to report to a file when running tests?
test {
systemProperty 'logback.configurationFile', 'src/test/resources/logback-scalatest.xml'
}
Thanks for the quick response. Interestingly enough, even running gradle with --quiet
doesn't silence the test output.
The following did the trick:
build.gradle
test {
systemProperties 'logback.configurationFile' : new File(projectDir,'src/test/resources/logback-test.xml').absolutePath
}
src/test/resources/logback-test.xml
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %5p | %t | %-55logger{55} | %m %n</pattern>
</encoder>
</appender>
<root>
<level value="ERROR"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
I still get the following somewhat annoying output at the start of every run, but I can live with that:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/lance.johnston/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.1.2/b316e9737eea25e9ddd6d88eaeee76878045c6b2/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/lance.johnston/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.10/b3eeae7d1765f988a1f45ea81517191315c69c9e/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Thanks for the suggestion!
Is is possible to control the log level of the tests being run? In my tests I'm seeing a lot of output like the following:
00:18:47.820 [ScalaTest-1-running-StatsGeneratorTest] DEBUG o.a.h.m.impl.MetricsSystemImpl - UgiMetrics, User and group related metrics 00:18:48.425 [ScalaTest-1-running-StatsGeneratorTest] DEBUG o.a.h.s.a.util.KerberosName - Kerberos krb5 configuration not found, setting default realm to empty 00:18:48.428 [ScalaTest-1-running-StatsGeneratorTest] DEBUG org.apache.hadoop.security.Groups - Creating new Groups object 00:18:48.432 [ScalaTest-1-running-StatsGeneratorTest] DEBUG o.a.hadoop.util.NativeCodeLoader - Trying to load the custom-built native-hadoop library... 00:18:48.434 [ScalaTest-1-running-StatsGeneratorTest] DEBUG o.a.hadoop.util.NativeCodeLoader - Failed to load native-hadoop with error: java.lang.UnsatisfiedL
Would like to be able to quiet that output, but have no idea if these even has anything to do with the scalatest plugin vs the tests themselves.
Thanks, Lance