How do I disable logging for junit with Gradle?

How do I disable logging for junit with Gradle?

I have: task test {

doFirst {

logging.captureStandardOutput LogLevel.INFO

logging.level = LogLevel.WARN

}

doLast {

logger.warn "log level set to: " + logging.getLevel()

} }

The messages I still see look like this: STANDARD_OUT [Test worker] DEBUG DEBUG_FRAME

Any thoughts? The STANDARD_OUT drove me to try and captureStandardOutput as INFO. My plan was to then set the logger to WARN so that these messages would be ignored.

Sounds like you don’t have a logging configuration file in place for the code under test. In that case, logging frameworks will typically log to standard out, which gets relayed to the Gradle JVM/console output.The best solution to prevent this is to put an appropriate logging configuration file into ‘src/test/resources’.

Peter - can you point to documentation on the “logging configuration file” that you mentioned? I’ve done a number of Google searches and read through the Logging section of the documentation and couldn’t find how to do this. Though it looks like the right answer for me as well.

Check the docs for the logging framework that you happen to be using (it’s not a Gradle thing).