gpt4 book ai didi

java - gradle:禁用输出显式导致详细输出

转载 作者:行者123 更新时间:2023-11-28 21:29:43 25 4
gpt4 key购买 nike

我使用 gradle 作为 spring boot 应用程序的构建工具,我遇到了一些奇怪的行为。 Gradle 显示更多关于显式关闭测试输出的日志记录信息,就好像我根本没有指定任何内容一样。

这很奇怪,因为显式禁用语句至少应该像没有配置一样具有表现力,或者不应该吗?

例子:如果我将以下行添加到我的 build.gradle,我会在运行 gradle test 时得到更详细的日志输出:

test{
testLogging {
showStackTraces = false
showStandardStreams = false
showExceptions = false
showCauses = false
events "failed"
exceptionFormat "short"
}
}

编辑:

我按照@Peter_Niederwieser 的建议将其更改为events = []。现在几乎所有消息都消失了,除了以下一条。有人或其他人知道我如何抑制它们吗?我只想显示结果 34 ​​tests completed 以及报告的链接。

:backend:test
Download http://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.6.2.201302030002/org.jacoco.agent-0.6.2.201302030002.pom
Download http://repo1.maven.org/maven2/org/jacoco/org.jacoco.build/0.6.2.201302030002/org.jacoco.build-0.6.2.201302030002.pom
Download http://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.6.2.201302030002/org.jacoco.agent-0.6.2.201302030002.jar
objc[1360]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
08:50:37.135 [Thread-7] INFO o.s.c.s.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@228186d4: startup date [Sat Dec 06 08:50:35 CET 2014]; root of context hierarchy
08:50:37.135 [Thread-6] INFO o.s.c.s.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@4d18a206: startup date [Sat Dec 06 08:50:35 CET 2014]; root of context hierarchy
08:50:37.135 [Thread-5] INFO o.s.c.s.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@5221dfe5: startup date [Sat Dec 06 08:50:35 CET 2014]; root of context hierarchy
08:50:37.135 [Thread-8] INFO o.s.w.c.s.GenericWebApplicationContext - Closing org.springframework.web.context.support.GenericWebApplicationContext@5a5fbef7: startup date [Sat Dec 06 08:50:36 CET 2014]; root of context hierarchy
08:50:37.166 [Thread-7] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
08:50:37.166 [Thread-6] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
08:50:37.167 [Thread-5] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
08:50:37.167 [Thread-8] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
08:50:37.167 [Thread-7] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@65bad9fe: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,testConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
08:50:37.168 [Thread-6] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c355f75: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,testConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
08:50:37.168 [Thread-5] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6dd79791: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,testConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
08:50:37.168 [Thread-8] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@75a5ec9: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.co ntext.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,testConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy
08:50:37.175 [Thread-7] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'testConfig'
08:50:37.175 [Thread-6] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'testConfig'
08:50:37.176 [Thread-5] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'testConfig'
08:50:37.176 [Thread-8] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'testConfig'

34 tests completed, 9 failed
:backend:test FAILED

最佳答案

默认为 events = []。上面的代码设置了 events "failed",这将导致更详细的日志记录(每个失败的测试都将单独记录)。

关于java - gradle:禁用输出显式导致详细输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27294345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com