Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1659

Log4j logger in TestExecutionListener corrupts Surefire's STDOUT.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0-M3
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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

        Attachments

        1. surefire-stdout-corrupt.zip
          8 kB
          Stig Rohde Døssing
        2. src.zip
          6 kB
          Edinson E. Padrón Urdaneta

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                srdo Stig Rohde Døssing
              • Votes:
                3 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: