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
logger.level=INFO
# HornetQ logger levels
#logger.org.hornetq.core.server.level=INFO
#logger.org.hornetq.journal.level=INFO
#logger.org.hornetq.utils.level=INFO
#logger.org.hornetq.jms.level=INFO
#logger.org.hornetq.integration.bootstrap.level=INFO
# Root logger handlers
logger.handlers=CONSOLE
# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=FINE
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN
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.
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
- 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
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.