You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Johannes Ernst <je...@acm.org> on 2001/08/22 02:06:42 UTC

Re: System.err gone? -- found it

I found it. And it indeed closes System.err. Here's the stack trace. 
(manually typed in from looking at JBuilder's debugger window -- 
there may be typos, after all, it's me typing ...)

java.io.Printstream.close # 117   -- and this instance is System.err
java.io.OutputStreamWriter.close # 259
java.io.FilterWriter.close # 89
WriterAppender.closeWriter # 212
WriterAppender.reset # 331
WriterAppender.close # 202
AppenderAttachableImpl.removeAllAppenders # 109
Category.remoteAllAppenders # 897
PropertyConfigurator.parseCategory # 586
PropertyConfigurator.configureRootCategory # 502
PropertyConfigurator.doConfigure # 410
PropertyConfigurator.configure # 341

The config file being set in the above call is:

log4j.rootCategory=DEBUG, A1, A2

log4j.categoryFactory=com.r_objects.util.logging.Log$LogFactory

# A1 is set to be a ConsoleAppender

log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] (%13F:%L)%n - %m%n%n

# Set options for appender named "A2"

log4j.appender.A2=org.apache.log4j.FileAppender
log4j.appender.A2.File=settings.log
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-5p %d [%t] %-17c{3} 
(%13F:%L) %n @ %C.%M:%L%n%n - %m%n-----------------%n

My (admittedly uneducated) guess would be that ConsoleAppender not 
only needs to override closeWriter() -- which it does -- but also 
close().


Let me know if you have any questions.


>Johannes,
>
>Nothing in the log4j core closes System.err. However, without 
>looking at your properties file it is hard to say what is going on. 
>For example, Jboss (http://jboss.org) maintains its own appender 
>which redirects system.err and system.out to a default category and 
>then to an appender. Your environment might play similar tricks on 
>you.
>
>In any case, your bug report is not meaningful without the contents 
>of your properties file. Regards, Ceki
>
>At 11:22 10.08.2001 -0700, Johannes Ernst wrote:
>>Ceki,
>>
>>I'm not sure I can beyond the code fragment below. Maybe some questions:
>>  - is there any chance that log4j calls "System.err.close()" 
>>somewhere under some circumstances? That would reproduce my 
>>behavior...
>>  - or a "redirect" in some form, such as 
>>"System.err=someOtherStream" -- I realize that System.err. is 
>>final, so maybe not
>>
>>If there's nothing that jumps out at you, the problem is probably 
>>on my end although I have no idea where to look ...
>>
>>>Johannes,
>>>
>>>Can you please more detail? Ceki
>>>
>>>At 16:39 09.08.2001 -0700, Johannes Ernst wrote:
>>>>Here's my code:
>>>>
>>>>System.err.println( "something" )   -- works as it should
>>>>PropertyConfigurator.configure( myProperties );
>>>>System.err.println( "some more" )    -- DOES NOT PRINT anything
>>>>
>>>>I realize this is either the world's easiest question or not 
>>>>answerable by anyone except me.
>>>>
>>>>The properties configure a ConsoleAppender and a RollingFileAppender.
>>>>
>>>>I appreciate your help. Cheers,
>>>>
>>>>
>>>>Johannes.
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>>
>>>--
>>>Ceki Gülcü - http://qos.ch
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>
>
>--
>Ceki Gülcü - http://qos.ch
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: System.err gone? -- found it

Posted by Johannes Ernst <je...@acm.org>.
>According to your stack trace ConsoleAppender.closeWriter is not 
>overriding WriterAppender.closeWriter which explains why System.eer 
>is being closed. I'll look into this ASAP. Which version of log4j is 
>this by the way? Thanks, Ceki

I believe it is 1.1.3.

Thanks for your quick response.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: System.err gone? -- found it

Posted by Ceki Gülcü <cg...@qos.ch>.
Johannes,

According to your stack trace ConsoleAppender.closeWriter is not overriding WriterAppender.closeWriter which explains why System.eer is being closed. I'll look into this ASAP. Which version of log4j is this by the way? Thanks, Ceki

At 17:06 21.08.2001 -0700, Johannes Ernst wrote:
>I found it. And it indeed closes System.err. Here's the stack trace. (manually typed in from looking at JBuilder's debugger window -- there may be typos, after all, it's me typing ...)
>
>java.io.Printstream.close # 117   -- and this instance is System.err
>java.io.OutputStreamWriter.close # 259
>java.io.FilterWriter.close # 89
>WriterAppender.closeWriter # 212
>WriterAppender.reset # 331
>WriterAppender.close # 202
>AppenderAttachableImpl.removeAllAppenders # 109
>Category.remoteAllAppenders # 897
>PropertyConfigurator.parseCategory # 586
>PropertyConfigurator.configureRootCategory # 502
>PropertyConfigurator.doConfigure # 410
>PropertyConfigurator.configure # 341
>
>The config file being set in the above call is:
>
>log4j.rootCategory=DEBUG, A1, A2
>
>log4j.categoryFactory=com.r_objects.util.logging.Log$LogFactory
>
># A1 is set to be a ConsoleAppender
>
>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] (%13F:%L)%n - %m%n%n
>
># Set options for appender named "A2"
>
>log4j.appender.A2=org.apache.log4j.FileAppender
>log4j.appender.A2.File=settings.log
>log4j.appender.A2.layout=org.apache.log4j.PatternLayout
>log4j.appender.A2.layout.ConversionPattern=%-5p %d [%t] %-17c{3} (%13F:%L) %n @ %C.%M:%L%n%n - %m%n-----------------%n
>
>My (admittedly uneducated) guess would be that ConsoleAppender not only needs to override closeWriter() -- which it does -- but also close().
>
>
>Let me know if you have any questions.
>
>
>>Johannes,
>>
>>Nothing in the log4j core closes System.err. However, without looking at your properties file it is hard to say what is going on. For example, Jboss (http://jboss.org) maintains its own appender which redirects system.err and system.out to a default category and then to an appender. Your environment might play similar tricks on you.
>>
>>In any case, your bug report is not meaningful without the contents of your properties file. Regards, Ceki
>>
>>At 11:22 10.08.2001 -0700, Johannes Ernst wrote:
>>>Ceki,
>>>
>>>I'm not sure I can beyond the code fragment below. Maybe some questions:
>>> - is there any chance that log4j calls "System.err.close()" somewhere under some circumstances? That would reproduce my behavior...
>>> - or a "redirect" in some form, such as "System.err=someOtherStream" -- I realize that System.err. is final, so maybe not
>>>
>>>If there's nothing that jumps out at you, the problem is probably on my end although I have no idea where to look ...
>>>
>>>>Johannes,
>>>>
>>>>Can you please more detail? Ceki
>>>>
>>>>At 16:39 09.08.2001 -0700, Johannes Ernst wrote:
>>>>>Here's my code:
>>>>>
>>>>>System.err.println( "something" )   -- works as it should
>>>>>PropertyConfigurator.configure( myProperties );
>>>>>System.err.println( "some more" )    -- DOES NOT PRINT anything
>>>>>
>>>>>I realize this is either the world's easiest question or not answerable by anyone except me.
>>>>>
>>>>>The properties configure a ConsoleAppender and a RollingFileAppender.
>>>>>
>>>>>I appreciate your help. Cheers,
>>>>>
>>>>>
>>>>>Johannes.
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>>>
>>>>--
>>>>Ceki Gülcü - http://qos.ch
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>
>>--
>>Ceki Gülcü - http://qos.ch
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>

--
Ceki Gülcü - http://qos.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org