Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging while testing through Gradle

While testing, Gradle appears to redirect stdout/stderr to project_dir/build/reports/tests/index.html. Is there a way to avoid this redirection, and get things printed to the console instead?

Additional information:

  • It's a Scala 2.9.1 project.
  • I am using slf4s for logging.
like image 477
missingfaktor Avatar asked Feb 20 '12 05:02

missingfaktor


People also ask

How do I view Gradle logs?

View -> Tool Windows -> Build. There is small "ab" button on the left panel. All gradle logs for current build are there.

What logger does Gradle use?

Internally, Gradle uses Ant and Ivy. Both have their own logging system.

Is Gradle used for testing?

Gradle executes tests in a separate ('forked') JVM, isolated from the main build process. This prevents classpath pollution and excessive memory consumption for the build process. It also allows you to run the tests with different JVM arguments than the build is using.


2 Answers

apply plugin : 'java'  test {     testLogging.showStandardStreams = true } 

http://gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html

This requires a current gradle version. I am assuming that the Scala tests are run under the Java test task.

like image 68
roby Avatar answered Sep 30 '22 19:09

roby


I am using also (testLogging.exceptionFormat = 'full'):

test {     testLogging.showStandardStreams = true     testLogging.exceptionFormat = 'full' } 

Which is good to see more from stacktrace

like image 31
To Kra Avatar answered Sep 30 '22 18:09

To Kra