I have a project that registers a JUnit 5 TestExecutionListener. The TestExecutionListener contains an SLF4j Logger, using Log4j2 as the underlying library. There is a log4j2.xml on the classpath, logging to console, and Surefire is set up to redirect output.
Running the tests gives the following result.
[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file ...
I've attached a minimal reproduction.
Doing either of the following eliminates the error:
- Not having the log4j2.xml on the classpath
- Not having the Logger in the TestExecutionListener
- is related to
SUREFIRE-1614 JUnit Runner that writes to System.out corrupts Surefire's STDOUT when using JUnit's Vintage Engine
- relates to
SUREFIRE-2058 Corrupted STDOUT by directly writing to native stream in forked JVM 1 with UTF-8 console logging
- links to