[ https://issues.apache.org/jira/browse/LOG4J2-619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14032038#comment-14032038 ]
Scott Harrington commented on LOG4J2-619: ----------------------------------------- Hi, I am not the original submitter but I observed this as well, in both rc1 and in trunk r1602630, and it turns out to be easy to fix (patch is attached). The issue is that XmlConfiguration constructor (a) swallows exceptions, and (b) encounters the parse failure before populating the FileConfigurationMonitor. So reconfigure() returns an instance that is useless AND that will never check the file again. A similar issue might exist in JsonConfiguration but I don't have an easy way to test that. An alternate fix would be to NOT swallow exceptions in the constructor. But I looked at the other callers e.g. XmlConfigurationFactory and concluded those cases are probably o.k. with a useless Configuration (unlike reconfigure which really shouldn't rip the monitor out from under us). > Unable to recover after loading corrupted XML > --------------------------------------------- > > Key: LOG4J2-619 > URL: https://issues.apache.org/jira/browse/LOG4J2-619 > Project: Log4j 2 > Issue Type: Bug > Affects Versions: 2.0-rc1 > Environment: CentOS 6.5, Oracle Java 7 u55 > Reporter: Sergey Burkov > Priority: Critical > Attachments: log4j-r1602630-reconfigure.patch > > > Steps to reproduce: > 1) auto-reloading of log4j 2.x configuration from XML is enabled > 2) system is started and producing logs > 3) change XML configuration, so it's not valid XML any longer > 4) Wait till it would be picked up -> no more logging info is produced, > exception can be found from logs (see below). > 5) Fix XML configuration -> it's not getting reloaded anymore, only java > restart can fix the problem. > log4j2.xml org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; The > processi > ng instruction target matching "[xX][mM][lL]" is not allowed. > at > com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257) > at > com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347) > at > org.apache.logging.log4j.core.config.XMLConfiguration.<init>(XMLConfiguration.java:145) > at > org.apache.logging.log4j.core.config.XMLConfiguration.reconfigure(XMLConfiguration.java:286) > at > org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:421) > at > org.apache.logging.log4j.core.config.FileConfigurationMonitor.checkConfiguration(FileConfigurationMonitor.java:79) > at > org.apache.logging.log4j.core.Logger$PrivateConfig.filter(Logger.java:279) > at org.apache.logging.log4j.core.Logger.isEnabled(Logger.java:117) > at > org.apache.logging.log4j.spi.AbstractLoggerWrapper.isEnabled(AbstractLoggerWrapper.java:82) > at > org.apache.logging.log4j.spi.AbstractLogger.isDebugEnabled(AbstractLogger.java:1071) > at org.slf4j.impl.SLF4JLogger.isDebugEnabled(SLF4JLogger.java:174) > at > org.apache.commons.logging.impl.SLF4JLocationAwareLog.isDebugEnabled(SLF4JLocationAwareLog.java:67) > .... > ERROR No logging configuration -- 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