Configure JUL/log4j for JUnit 5 in spring-test

Issue: SPR-14431
This commit is contained in:
Sam Brannen 2016-07-13 22:06:46 +02:00
parent 833deadddc
commit adfea826cc
3 changed files with 15 additions and 0 deletions

View File

@ -890,6 +890,8 @@ project("spring-test") {
testCompile("org.apache.httpcomponents:httpclient:${httpclientVersion}")
testCompile("javax.cache:cache-api:1.0.0")
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
// Java Util Logging for JUnit 5.
testRuntime("org.apache.logging.log4j:log4j-jul:${log4jVersion}")
testRuntime("org.ehcache:ehcache:${ehcache3Version}")
testRuntime("org.terracotta:management-model:2.0.0")
}
@ -911,6 +913,8 @@ project("spring-test") {
scanForTestClasses = false
include(['**/*Tests.class', '**/*Test.class', '**/SpringJUnitJupiterTestSuite.class'])
exclude(['**/testng/**/*.*'])
// Java Util Logging for JUnit 5.
// systemProperty('java.util.logging.manager', 'org.apache.logging.log4j.jul.LogManager')
}
task aggregateTestReports(type: TestReport) {

View File

@ -31,6 +31,16 @@ import org.junit.runner.RunWith;
* build. This class is therefore responsible for executing all JUnit
* Jupiter based tests in Spring's official test suite.
*
* <h3>Logging Configuration</h3>
*
* <p>In order for our log4j2 configuration to be used in an IDE, you must
* set the following system property before running any tests &mdash; for
* example, in <em>Run Configurations</em> in Eclipse.
*
* <pre style="code">
* -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
* </pre>
*
* @author Sam Brannen
* @since 5.0
*/

View File

@ -9,6 +9,7 @@
</File>
</Appenders>
<Loggers>
<Logger name="org.junit.platform" level="info" />
<Logger name="org.springframework.test.context" level="warn" />
<Logger name="org.springframework.test.context.TestContext" level="warn" />
<Logger name="org.springframework.test.context.TestContextManager" level="warn" />