Skip to content

Commit 3c12f39

Browse files
committed
Merge branch '3.1.x'
Closes gh-36860
2 parents bd0652f + 30bfc34 commit 3c12f39

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

+24
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,30 @@
5656
* }
5757
*
5858
* }
59+
* </pre>
60+
* <p>
61+
* To ensure that their output can be captured, Java Util Logging (JUL) and Log4j2 require
62+
* additional configuration.
63+
* <p>
64+
* To reliably capture output from Java Util Logging, reset its configuration after each
65+
* test:
66+
*
67+
* <pre class="code">
68+
* &#064;AfterEach
69+
* void reset() throws Exception {
70+
* LogManager.getLogManager().readConfiguration();
71+
* }
72+
* </pre>
73+
* <p>
74+
* To reliably capture output from Log4j2, set the <code>follow</code> attribute of the
75+
* console appender to <code>true</code>:
76+
*
77+
* <pre class="code">
78+
* &lt;Appenders&gt;
79+
* &lt;Console name="Console" target="SYSTEM_OUT" follow="true"&gt;
80+
* ...
81+
* &lt;/Console&gt;
82+
* &lt;/Appenders&gt;
5983
* </pre>
6084
*
6185
* @author Madhura Bhave

0 commit comments

Comments
 (0)