[
https://issues.apache.org/jira/browse/LOG4J2-2068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201184#comment-16201184
]
Robert Haycock commented on LOG4J2-2068:
----------------------------------------
I created a branch but can't push, keep getting authentication failed. Here's a
better unit test...
{code}
@Test
public void testConfigReloaded() {
final LoggerContextRule lcr = new
LoggerContextRule("log4j-console.xml,log4j-console.xml");
final Statement test = new Statement() {
@Override
public void evaluate() throws Throwable {
final CompositeConfiguration config = (CompositeConfiguration)
lcr.getConfiguration();
Assert.assertNotNull(config);
// Register a listener to listen for errors
final AtomicInteger i = new AtomicInteger(0);
StatusLogger.getLogger().registerListener(new StatusListener() {
@Override
public void close()
throws IOException {
}
@Override
public void log(StatusData data) {
i.incrementAndGet();
}
@Override
public Level getStatusLevel() {
return Level.ERROR;
}
});
// onChange() would be called if files were modified
lcr.getLoggerContext().onChange(config);
assertTrue("There should be no errors logged when
reconfiguring", i.get() == 0);
}
};
runTest(lcr, test);
}
{code}
> Can't set monitorInterval for composite XML configuration.
> ----------------------------------------------------------
>
> Key: LOG4J2-2068
> URL: https://issues.apache.org/jira/browse/LOG4J2-2068
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.9.1
> Reporter: Robert Haycock
> Fix For: 2.9.2
>
> Attachments: patch_2068.diff
>
>
> When trying to combine a composite configuration with automatic reload, it
> fails to reload.
> When an {{XmlConfiguration}} is reloaded it calls
> {{XmlConfiguration.reconfigure()}} which sets the {{rootElement}} field, and
> everything is fine.
> When a {{CompositeConfiguration}} is reloaded, it doesn't call
> {{reconfigure()}} on the {{XmlConfigurations}}. This means when it tries to
> start the config {{XmlConfiguration.setup()}} is called and {{rootElement}}
> is null, resulting in an error message "No logging configuration".
> End result is the config isn't loaded and there's no more logging.
> To reproduce, it doesn't matter what is in the configurations. Just need at
> least 2 XML configs in the {{log4j.configurationFile}} property and the
> {{monitorInterval}} set.
> (Ps. my first ticket)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)