Ser*_*ipc 15 log4j surefire maven
当测试在maven中失败时,surefire测试报告xml文件target/surefire-reports/TEST-<test-name>.xml仅显示标准输出System.output或标准错误System.err
当我使用jdk时,java.util.logging.Logger所有日志记录都显示在标准错误中<system-err> tag,但是当我使用log4j时它没有显示.
log4j的日志记录通过FileAppender和ConsoleAppender正常工作.它显示在完整的控制台输出中,但不显示在各个测试报告文件中.
System.out以便在surefire rerports中显示吗?car*_*ing 13
方案一:
对于标准日志记录(System.out/System.err),您可以具有以下输出:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这将为每个测试生成输出文件.
方案二:
对于log4j配置,您可以创建自定义log4j.xml/log4j.properties并将其放在src/test/resources下.
| 归档时间: |
|
| 查看次数: |
12687 次 |
| 最近记录: |