Browse Source

Merge branch '3.1.x'

Closes gh-36860
pull/36455/head
Andy Wilkinson 3 years ago
parent
commit
3c12f39adb
  1. 24
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureExtension.java

24
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureExtension.java

@ -56,6 +56,30 @@ import org.junit.jupiter.api.extension.ParameterResolver; @@ -56,6 +56,30 @@ import org.junit.jupiter.api.extension.ParameterResolver;
* }
*
* }
* </pre>
* <p>
* To ensure that their output can be captured, Java Util Logging (JUL) and Log4j2 require
* additional configuration.
* <p>
* To reliably capture output from Java Util Logging, reset its configuration after each
* test:
*
* <pre class="code">
* &#064;AfterEach
* void reset() throws Exception {
* LogManager.getLogManager().readConfiguration();
* }
* </pre>
* <p>
* To reliably capture output from Log4j2, set the <code>follow</code> attribute of the
* console appender to <code>true</code>:
*
* <pre class="code">
* &lt;Appenders&gt;
* &lt;Console name="Console" target="SYSTEM_OUT" follow="true"&gt;
* ...
* &lt;/Console&gt;
* &lt;/Appenders&gt;
* </pre>
*
* @author Madhura Bhave

Loading…
Cancel
Save