That seems like the most user friendly solution. 

Sure you get an exception if you try to write to a closed file but logging 
feels like a special case.

Gary




<div>-------- Original message --------</div><div>From: Ralph Goers 
<[email protected]> </div><div>Date:05/17/2014  00:48  (GMT-05:00) 
</div><div>To: Log4J Developers List <[email protected]> 
</div><div>Subject: Re: [jira] [Commented] (LOG4J2-639) NPE in 
AsyncLogger.log(..) </div><div>
</div>I prefer not throwing an exception but logging it to the status logger.

Ralph

On May 16, 2014, at 7:16 PM, Remko Popma (JIRA) <[email protected]> wrote:

> 
>    [ 
> https://issues.apache.org/jira/browse/LOG4J2-639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14000616#comment-14000616
>  ] 
> 
> Remko Popma commented on LOG4J2-639:
> ------------------------------------
> 
> What is the expected behaviour if an application tries to use a Logger after 
> the logging subsystem has been shut down?
> 
> I see two options: throwing an exception (perhaps an IllegalStateException 
> with a clearer message) or ignoring the call (perhaps log a 
> StatusLogger.fatal("Ignoring log event: log4j has been shut down") message). 
> Users may never see the status logger message, but that is a minor issue.
> 
> The main question is, is it okay for a Logger to throw an exception in this 
> case or not? 
> 
>> NPE in AsyncLogger.log(..)
>> --------------------------
>> 
>>                Key: LOG4J2-639
>>                URL: https://issues.apache.org/jira/browse/LOG4J2-639
>>            Project: Log4j 2
>>         Issue Type: Bug
>>         Components: Appenders
>>   Affects Versions: 2.0-rc1
>>           Reporter: Mck SembWever
>>           Assignee: Remko Popma
>> 
>> Our production environment suffers from
>> {noformat}
>> java.lang.NullPointerException at 
>> org.apache.logging.log4j.core.async.AsyncLogger.log(AsyncLogger.java:273)
>>    at 
>> org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLoggerWrapper.java:121)
>>    at 
>> org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1006) 
>>    at 
>> org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:873)
>>  
>>    at 
>> org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:809)
>> {noformat}
>> It looks like something in our app is still logging despite the AsyncLogger 
>> having been stopped (and the disruptor field set to null).
>> The logger could print out a more informative message in this situation.
> 
> 
> 
> --
> This message was sent by Atlassian JIRA
> (v6.2#6252)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


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

Reply via email to