diff --git a/build.gradle b/build.gradle index 3fad5a7be8..0616ccd61c 100644 --- a/build.gradle +++ b/build.gradle @@ -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) { diff --git a/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java b/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java index bcd5bd59de..e6b0e14fd5 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java @@ -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. * + *
In order for our log4j2 configuration to be used in an IDE, you must + * set the following system property before running any tests — for + * example, in Run Configurations in Eclipse. + * + *
+ * -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager + *+ * * @author Sam Brannen * @since 5.0 */ diff --git a/spring-test/src/test/resources/log4j2-test.xml b/spring-test/src/test/resources/log4j2-test.xml index 533f9aa9ff..bfcf311890 100644 --- a/spring-test/src/test/resources/log4j2-test.xml +++ b/spring-test/src/test/resources/log4j2-test.xml @@ -9,6 +9,7 @@