You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "René Kraneis (JIRA)" <ji...@apache.org> on 2019/06/14 06:20:00 UTC
[jira] [Comment Edited] (SUREFIRE-1659) Log4j logger in
TestExecutionListener corrupts Surefire's STDOUT.
[ https://issues.apache.org/jira/browse/SUREFIRE-1659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16863398#comment-16863398 ]
René Kraneis edited comment on SUREFIRE-1659 at 6/14/19 6:19 AM:
-----------------------------------------------------------------
We had similar problems when just logging in unit tests. Changing the console appender configuration to {{follow=true}} resolved the problem for us. Explicitly setting {{direct=false}} did not do the trick. Unfortunately none of these flags have an associated default value at [https://logging.apache.org/log4j/2.x/manual/appenders.html]. _Edit: this is also true for surefire 2.x and should probably be noted in surefires FAQ, as Log4j2 is quite widely used._
was (Author: rkraneis):
We had similar problems when just logging in unit tests. Changing the console appender configuration to ``follow=true`` resolved the problem for us. Explicitly setting ``direct=false`` did not do the trick. Unfortunately none of these flags have an associated default value at https://logging.apache.org/log4j/2.x/manual/appenders.html.
> Log4j logger in TestExecutionListener corrupts Surefire's STDOUT.
> -----------------------------------------------------------------
>
> Key: SUREFIRE-1659
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1659
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 3.0.0-M3
> Reporter: Stig Rohde Døssing
> Priority: Major
> Attachments: surefire-stdout-corrupt.zip
>
>
> 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.
> {quote}
> [WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file ...
> {quote}
> 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
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)