Skip to content

Commit

Permalink
Describe quirks of JUL and Log4j2 in OutputCaptureExtension javadoc
Browse files Browse the repository at this point in the history
Closes gh-32562
  • Loading branch information
wilkinsona committed Aug 9, 2023
1 parent 694ff4f commit 21de3fb
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@
* }
*
* }
* </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
Expand Down

0 comments on commit 21de3fb

Please sign in to comment.