Skip to content

Instantly share code, notes, and snippets.

@ysb33r
Created August 19, 2014 15:36
Show Gist options
  • Save ysb33r/68ba7ad1279d0492086a to your computer and use it in GitHub Desktop.
Save ysb33r/68ba7ad1279d0492086a to your computer and use it in GitHub Desktop.
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
Copy link

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