[ 
https://issues.apache.org/jira/browse/LOG4J2-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13714655#comment-13714655
 ] 

Ralph Goers commented on LOG4J2-124:
------------------------------------

Let's start with this. How would you implement it? You cannot add a shutdown 
method that calls getContext() and casts it to 
org.apache.logging.core.LoggerContext so you can't call the stop method. The 
implication here is that the org.apache.logging.log4j.LoggerContext has to have 
a shutdown method added and that every Log4j 2.0 implementation that might 
exist then would have to implement it. Currently the LoggerContext interface is 
extremely simple and only contain two getLogger methods and a hasLogger method. 
I really would prefer it be kept simple.

On the other hand, the Configurator class already has a shutdown method that 
requires a LoggerContext as a parameter. I would have no problem with adding 
another shutdown method that takes no arguments.


                
> Gracefully stopping LogContext using the api interfaces
> -------------------------------------------------------
>
>                 Key: LOG4J2-124
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-124
>             Project: Log4j 2
>          Issue Type: Question
>    Affects Versions: 2.0-beta3
>            Reporter: Szabolcs Beki
>            Priority: Minor
>
> I'm trying to gracefully close my SocketAppender before exiting the my 
> application to avoid IOExceptions on the socket server side.  
> Currently I can make it only by using interface the 
> org.apache.logging.log4j.core.Lifecycle interface in the Log4j2 core  : 
> ((Lifecycle) LogManager.getContext()).stop();
> I would prefer to have a cleaner solution that uses solely the Log4j-api not 
> Log4j-core. 
> Did I overlook something or stop() on the API side really missing ? 

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

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

Reply via email to