Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HOWTO control logging running tests from Gradle
// IN the build.gradle file
test {
systemProperties 'logback.configurationFile' : new File(projectDir,'src/test/resources/logback-test.xml').absolutePath
}
<!-- Place this file in src/test/resources -->
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- control the level of output here -->
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@Hubbitus

This comment has been minimized.

Copy link

@Hubbitus Hubbitus commented Nov 1, 2018

It looks like it does not work in fresh versions of gradle https://discuss.gradle.org/t/logback-xml-versus-gradle-build/340

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment