This is done now in revision 1603937. I pulled back from removing field configLocation (and getter/setter) from LoggerContext as I couldn't quite understand how that field is used. (It seems that even if this field is null it is still possible to reconfigure() the logger context?) So I left that alone, I just documented in LoggerContext.getConfigLocation() that this field may be out of date and a more reliable way to get the config location/contents is via getConfiguration().getConfigurationSource().
All Configurations now must have a ConfigurationSource, so for tests it is convenient to use ConfigurationSource.NULL_SOURCE. Finally, ConfigurationSource now cannot be constructed with a String anymore. It must be given a File or a URL (or just the InputStream). This facilitates creating a new ConfigurationSource and was in line with actual usage anyway. On Mon, Jun 16, 2014 at 8:32 AM, Matt Sicker <[email protected]> wrote: > Sounds like a good idea! > > > On 15 June 2014 10:50, Ralph Goers <[email protected]> wrote: > >> I have no objections. >> >> Ralph >> >> On Jun 15, 2014, at 6:46 AM, Gary Gregory <[email protected]> wrote: >> >> It sounds like you have a good user story. Thoughts from Ralph? >> >> Gary >> >> >> -------- Original message -------- >> From: Remko Popma >> Date:06/15/2014 08:33 (GMT-05:00) >> To: Log4J Developers List >> Subject: LoggerContext config location >> >> I would like the ability to get the ConfigurationSource from the >> LoggerContext in order to fix LOG4J2-539 >> <https://issues.apache.org/jira/browse/LOG4J2-539>. >> >> Currently LoggerContext has a field configLocation:URI, but this field >> may (or may not) be initialized when the LoggerContext is constructed, and >> is not updated when it is reconfigured. In fact, all reconfiguring uses >> inner class ConfigurationFactory.ConfigurationSource. >> >> I would like to make the following changes: >> * make ConfigurationFactory.ConfigurationSource a top-level class >> * add method getConfigurationSource to the Configuration interface >> * remove field configLocation (and getter/setter) from LoggerContext >> >> Client code that needs LoggerContext.getConfigLocation() can instead call >> LoggerContext.getConfiguration().getConfigurationSource(). >> This is more reliable than getConfigLocation() as this URI is often null >> and may not be in sync with the LoggerContext's Configuration after a >> reconfigure. >> >> Thoughts? >> >> >> > > > -- > Matt Sicker <[email protected]> >
