Why does "gradle test" default logging to DEBUG level?

(Matthew Giannini) #1

I have a logging.properties file configured for my test classes (see below).

Whey I run “gradle test” it is showing logs at the DEBUG level even though i have the root logger configured at level INFO. If I explicitly set the “handler.CONSOLE.level=INFO”, then the tests log at INFO level. But it seems like I should not have to do that.

I am using Gradle 1.4. Could somebody help me understand how to make the test output log by default at INFO level instead of DEBUG? Thank you.

# Root logger level
# HornetQ logger levels
# Root logger handlers
  # Console handler configuration

(Peter Niederwieser) #2

Gradle executes tests in a separate JVM. In order for test logging output to show up on the screen, that logging output will have to be sent to standard out/err of the test JVM, where it is captured by Gradle, sent back to the “main” JVM, and printed there.

By default, standard out/err of test JVMs is only shown when running with ‘–debug’. The quickest way to always show it is ‘test.testLogging.showStandardStreams = true’. For further configuration options, see the Gradle DSL reference.

(Matthew Giannini) #3

Peter - thank you for your prompt response.

I am ok with the default behavior your describe. However, what seems odd to me is that the “test” JVM appears to be logging at java.util.logging level DEBUG, even though my logging.properties (see above) is configured to only log at level INFO.

Does the “test” JVM automatically set JUL logging to DEBUG level?

To summarize my unexpected behavior

  1. I run simply “gradle test” 2) I have logging.properties configured to only log at level INFO 3) I am seeing JUL logging at level DEBUG from the test JVM. I expect to only see INFO level logging.

Thanks and Regards, matthew

(Peter Niederwieser) #4

Does ‘.level=INFO’ help?

(Matthew Giannini) #5

My extreme apologies - Upon further investigation this is, of course, user error. My logging.properties was incorrect (I forgot to set the logging level for a particular package).

I really appreciate your following up on this question, and I apologize for wasting your time on this.