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

Bruce Brouwer commented on LOG4J2-609:
--------------------------------------

Why is {{StatusConfiguration.configureExistingStatusConsoleListener}} 
reconfiguring all {{StatusConsoleListener}}s? If I had multiple 
{{LoggerContext}}s with different XML configurations, why should the newest 
{{LoggerContext}} be modifying the listeners from other {{LoggerContext}}s? If 
a {{LoggerContext}} is shutting down or being reconfigured, I would think it 
should only mess around with the listeners that it had registered. 

What I was thinking of doing was changing {{StatusConfiguration.initialize()}} 
to return a {{StatusConsoleListener}}, which {{XMLConfiguration}} could store 
in a field so that when {{XMLConfiguration.stop()}} or 
{{XMLConfiguration.reconfigure()}} is called, it can unregister just its own 
listener from the {{StatusLogger}}. Then it could add a new listener if 
necessary, such as when calling {{reconfigure()}}. Or maybe it keeps the 
{{StatusConfiguration}} object in a field instead and calls a new 
{{StatusConfiguration.stop()}} method that unregisters whatever it registered. 

I'm not an expert in here. Am I thinking about this correctly?

> StatusConfiguration doesn't close files
> ---------------------------------------
>
>                 Key: LOG4J2-609
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-609
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-rc1
>            Reporter: Bruce Brouwer
>
> {{org.apache.logging.log4j.core.config.status.StatusConfiguration}} allows 
> you to specify a destination such as "out", "err" or a file name. If 
> specifying a file, that file stream is used when creating a 
> {{StatusConsoleListener}} that is added to the {{StatusLogger}}. Those 
> {{StatusLogger}} listeners are never cleaned up when, for example, the 
> {{XmlConfiguration}} is reconfigured or when the {{LoggerContext}} is shut 
> down (e.g. in {{InitialLoggerContext.apply()}}). This leaves open file 
> handles and is the source of the failing test {{FileOutputTest}} on Windows. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to