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