[ 
https://issues.apache.org/jira/browse/LOG4J2-514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wolf480 Pl updated LOG4J2-514:
------------------------------

    Description: 
If the Console appender is not specified in the configuration file, after the 
configuration is read, the Console appender is being destroyed, which causes it 
to release its OutputStreamManager, When this manager is released and closed, 
it checks if the stream is System.out or System.err, and if it is, doesn't 
close it. But on Windows, ConsoleAppender wraps the System.out into a 
WindowsAnsiOutputStream. The OutputStreamManager closes the stream when it's 
released, and the stream closes the underlaying System.out.

proof: http://imageshack.com/a/img31/8296/cg6b.png

I think the easiest solution would be to use new 
FileOutputStream(FileDescriptor.out)) instead of System.out in ConsoleAppender 
implementation.

  was:
If the Console appender is not specified in the configuration file, after the 
configuration is read, the Console appender is being destroyed, which causes it 
to release its OutputStreamManager, When this manager is released and closed, 
it checks if the stream is System.out or System.err, and if it is, doesn't 
close it. But on Windows, ConsoleAppender wraps the System.out into a 
WindowsAnsiOutputStream. The OutputStreamManager closes the stream when it's 
released, and the stream closes the underlaying System.out.

I think the easiest solution would be to use new 
FileOutputStream(FileDescriptor.out)) instead of System.out in ConsoleAppender 
implementation.


> ConsoleAppender closing System.out on Windows
> ---------------------------------------------
>
>                 Key: LOG4J2-514
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-514
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0-beta9
>         Environment: Windows 7 64-bit
> Oracle JDK 1.7.0_51
>            Reporter: Wolf480 Pl
>
> If the Console appender is not specified in the configuration file, after the 
> configuration is read, the Console appender is being destroyed, which causes 
> it to release its OutputStreamManager, When this manager is released and 
> closed, it checks if the stream is System.out or System.err, and if it is, 
> doesn't close it. But on Windows, ConsoleAppender wraps the System.out into a 
> WindowsAnsiOutputStream. The OutputStreamManager closes the stream when it's 
> released, and the stream closes the underlaying System.out.
> proof: http://imageshack.com/a/img31/8296/cg6b.png
> I think the easiest solution would be to use new 
> FileOutputStream(FileDescriptor.out)) instead of System.out in 
> ConsoleAppender implementation.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to