When I create a test project with ProjectBuilder, and set the project logging level, but I’m still getting debugging output. I’ve created a test that shows that the logging level for the project is set to Error, the logger still shows that Debug is enabled. What else do I need to do to set the logging level correctly using ProjectBuilder?
class LoggingLevelIssueTest {
Project project
@Before
void setUp() throws Exception {
project = ProjectBuilder.builder().build()
project.apply plugin: 'java'
project.repositories {
mavenCentral()
}
project.dependencies {
compile 'commons-lang:commons-lang:2.6'
}
}
@Test
void logLevelSetToError() {
println "Logging Level: ${project.logging.level}"
println "Is Debug Enabled: ${project.logger.isDebugEnabled()}"
project.logging.level = LogLevel.ERROR
println "Logging Level After Setting to ERROR: ${project.logging.level}"
println "Is Debug Enabled: ${project.logger.isDebugEnabled()}"
assert project.logging.level == LogLevel.ERROR && project.logger.isDebugEnabled() == false
}
}