本文介绍了通过 Gradle 测试时记录日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在测试时,Gradle 似乎将 stdout/stderr 重定向到 project_dir/build/reports/tests/index.html
.有没有办法避免这种重定向,而是将内容打印到控制台?
While testing, Gradle appears to redirect stdout/stderr to project_dir/build/reports/tests/index.html
. Is there a way to avoid this redirection, and get things printed to the console instead?
附加信息:
- 这是一个 Scala 2.9.1 项目.
- 我正在使用 slf4s 进行日志记录.
- It's a Scala 2.9.1 project.
- I am using slf4s for logging.
推荐答案
apply plugin : 'java'
test {
testLogging.showStandardStreams = true
}
http://gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html
这需要当前的 gradle 版本.我假设 Scala 测试在 Java 测试任务下运行.
This requires a current gradle version. I am assuming that the Scala tests are run under the Java test task.
这篇关于通过 Gradle 测试时记录日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!