On 28.02.2011 16:07, Christian Grobmeier wrote:
Looking at the source code, I
cannot see what you mean - in consoleappender new streams are created,
the writerappender is doing nothing. Were is it closed? As far as I
can see only the previous stream is closed, once you set a new one.

But in this case, only the follow option is changed, so the previous
(underlying) stream is the same as the new one. I. e. the stream is closed,
so  writing to it fails.

But nevertheless, even if I would change the stream, from say System.err to
System.out, the previous stream shouldn't be closed, as no one could ever
write to System.err again.

Think you got me wrong... please look at this file:
https://svn.apache.org/repos/asf/logging/log4j/trunk/src/main/java/org/apache/log4j/ConsoleAppender.java

to activateOptions. You call this and it will set the standard i/o. I
cannot see were it is closed. Can you point me?


activateOptions calls WriterAppender.setWriter(), which first calls reset(), 
which in turn calls closeWriter().
see
https://svn.apache.org/repos/asf/logging/log4j/trunk/src/main/java/org/apache/log4j/WriterAppender.java
(the base class of ConsoleAppender containing all mentioned methods)

Martin

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

Reply via email to