You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marco Brandizi (JIRA)" <ji...@codehaus.org> on 2012/08/06 18:27:21 UTC

[jira] (SUREFIRE-900) System.err seems to be ignored

Marco Brandizi created SUREFIRE-900:
---------------------------------------

             Summary: System.err seems to be ignored
                 Key: SUREFIRE-900
                 URL: https://jira.codehaus.org/browse/SUREFIRE-900
             Project: Maven Surefire
          Issue Type: Bug
    Affects Versions: 2.7.2
         Environment: OS/X 10.7.4
            Reporter: Marco Brandizi
            Priority: Minor
         Attachments: testSureFireStdErr.zip

See the attached project. If I send something to System.err from a JUnit test and then I try 'mvn test 2>/dev/null', I can still see the output on the console, surefire (or Maven?!) seems to ignore this. I've tried with -Dsurefire.forkMode=false too. Is it possible to redirect the standard error? I'd like to do that because I have a few tests that tests a line command (ie, main()). Since the command is supposed to return XML to the invoker (which, for example, might pipe it to another command), I've implemented this command line by sending all the logging output to System.err (that's possible in Logback via the 'Target' option in the Console appender). When I invoke this line command outside Maven/Surefire it works as I want. In Maven, instead, I cannot what I described. 


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-900) System.err seems to be ignored

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/SUREFIRE-900?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold closed SUREFIRE-900.
---------------------------------------

    Resolution: Won't Fix
      Assignee: Kristian Rosenvold

System.out and System.err are captured by surefire, and that is not going to change. You can either use the plugin parameter redirectTestOutputToFile or you can use "System.setErr" to a stream of your own inside the test; preferably forwarding the output to the original System.err stream
                
> System.err seems to be ignored
> ------------------------------
>
>                 Key: SUREFIRE-900
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-900
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.7.2
>         Environment: OS/X 10.7.4
>            Reporter: Marco Brandizi
>            Assignee: Kristian Rosenvold
>            Priority: Minor
>         Attachments: testSureFireStdErr.zip
>
>
> See the attached project. If I send something to System.err from a JUnit test and then I try 'mvn test 2>/dev/null', I can still see the output on the console, surefire (or Maven?!) seems to ignore this. I've tried with -Dsurefire.forkMode=false too. Is it possible to redirect the standard error? I'd like to do that because I have a few tests that tests a line command (ie, main()). Since the command is supposed to return XML to the invoker (which, for example, might pipe it to another command), I've implemented this command line by sending all the logging output to System.err (that's possible in Logback via the 'Target' option in the Console appender). When I invoke this line command outside Maven/Surefire it works as I want. In Maven, instead, I cannot what I described. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-900) System.err seems to be ignored

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/SUREFIRE-900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=305890#comment-305890 ] 

Kristian Rosenvold commented on SUREFIRE-900:
---------------------------------------------

Well we might be able to fix that ;) I just said we capture it and then play it back. Of course we can (and should) play back to stderr.

                
> System.err seems to be ignored
> ------------------------------
>
>                 Key: SUREFIRE-900
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-900
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.7.2
>         Environment: OS/X 10.7.4
>            Reporter: Marco Brandizi
>            Assignee: Kristian Rosenvold
>            Priority: Minor
>         Attachments: testSureFireStdErr.zip
>
>
> See the attached project. If I send something to System.err from a JUnit test and then I try 'mvn test 2>/dev/null', I can still see the output on the console, surefire (or Maven?!) seems to ignore this. I've tried with -Dsurefire.forkMode=false too. Is it possible to redirect the standard error? I'd like to do that because I have a few tests that tests a line command (ie, main()). Since the command is supposed to return XML to the invoker (which, for example, might pipe it to another command), I've implemented this command line by sending all the logging output to System.err (that's possible in Logback via the 'Target' option in the Console appender). When I invoke this line command outside Maven/Surefire it works as I want. In Maven, instead, I cannot what I described. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (SUREFIRE-900) System.err seems to be ignored

Posted by "Marco Brandizi (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/SUREFIRE-900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=305857#comment-305857 ] 

Marco Brandizi commented on SUREFIRE-900:
-----------------------------------------

Thanks for your reply. System.setErr() solved my specific problem. In general, it's strange for me that one cannot do something as easy as mvn test 2>/dev/null and see just the standard output, not the standard error, which might give non-useful information in certain situations. But OK, I can live with that.
                
> System.err seems to be ignored
> ------------------------------
>
>                 Key: SUREFIRE-900
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-900
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.7.2
>         Environment: OS/X 10.7.4
>            Reporter: Marco Brandizi
>            Assignee: Kristian Rosenvold
>            Priority: Minor
>         Attachments: testSureFireStdErr.zip
>
>
> See the attached project. If I send something to System.err from a JUnit test and then I try 'mvn test 2>/dev/null', I can still see the output on the console, surefire (or Maven?!) seems to ignore this. I've tried with -Dsurefire.forkMode=false too. Is it possible to redirect the standard error? I'd like to do that because I have a few tests that tests a line command (ie, main()). Since the command is supposed to return XML to the invoker (which, for example, might pipe it to another command), I've implemented this command line by sending all the logging output to System.err (that's possible in Logback via the 'Target' option in the Console appender). When I invoke this line command outside Maven/Surefire it works as I want. In Maven, instead, I cannot what I described. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira