[jira] [Updated] (LOG4J2-1912) CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed.
[ https://issues.apache.org/jira/browse/LOG4J2-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] R Ri updated LOG4J2-1912: - Priority: Major (was: Trivial) > CompositeConfiguration: Unable to determine URI for configuration. However, > the reconfiguration is completed. > - > > Key: LOG4J2-1912 > URL: https://issues.apache.org/jira/browse/LOG4J2-1912 > Project: Log4j 2 > Issue Type: Bug > Components: API >Affects Versions: 2.8.1 >Reporter: R Ri > Original Estimate: 1h > Remaining Estimate: 1h > > Hello everybody, > I found a possible bug in class CompositeConfiguration: Unable to determine > URI for configuration. However, the reconfiguration is completed. > The solution: > In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the > condition: > {code:java} > if (sourceURI != null)" --> "if (sourceURI == null) > {code} > Original code: > {code:java} > 145@Override > 146public Configuration reconfigure() { > 147LOGGER.debug("Reconfiguring composite configuration"); > 148final List configs = new ArrayList<>(); > 149final ConfigurationFactory factory = > ConfigurationFactory.getInstance(); > 150for (final AbstractConfiguration config : configurations) { > 151final ConfigurationSource source = > config.getConfigurationSource(); > 152final URI sourceURI = source.getURI(); > 153Configuration currentConfig; > 154if (sourceURI != null) { > 155LOGGER.warn("Unable to determine URI for configuration {}, > changes to it will be ignored", > 156config.getName()); > 157currentConfig = > factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); > 158if (currentConfig == null) { > 159LOGGER.warn("Unable to reload configuration {}, > changes to it will be ignored", config.getName()); > 160currentConfig = config; > 161} > 162} else { > 163currentConfig = config; > 164} > 165configs.add((AbstractConfiguration) currentConfig); > 166 > 167} > 168 > 169return new CompositeConfiguration(configs); > 170} > {code} > So it makes sense, because after that it will be tried to reload the > configuration again, and if it does not work, I get a warn, otherwise is ok. > The changed code might look like this: > {code:java} > @Override > public Configuration reconfigure() { > LOGGER.debug("Reconfiguring composite configuration"); > final List configs = new ArrayList<>(); > final ConfigurationFactory factory = > ConfigurationFactory.getInstance(); > for (final AbstractConfiguration config : configurations) { > final ConfigurationSource source = > config.getConfigurationSource(); > final URI sourceURI = source.getURI(); > if (sourceURI == null) { > LOGGER.warn("Unable to determine URI for configuration {}, > changes to it will be ignored", config.getName()); > Configuration currentConfig = > factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); > if (currentConfig == null) { > LOGGER.warn("Unable to reload configuration {}, changes > to it will be ignored", config.getName()); > } > else { > LOGGER.info("Able to reload configuration {}, changes to > it will be completed", config.getName()); > configs.add((AbstractConfiguration) currentConfig); > } > } else { > configs.add(config); > } > } > return new CompositeConfiguration(configs); > } > {code} > Your feedback and questions are welcome. Thanks! > Best regards, > rri -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (LOG4J2-1912) CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed.
[ https://issues.apache.org/jira/browse/LOG4J2-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] R Ri updated LOG4J2-1912: - Description: Hello everybody, I found a possible bug in class CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed. The solution: In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the condition: {code:java} if (sourceURI != null)" --> "if (sourceURI == null) {code} Original code: {code:java} 145@Override 146public Configuration reconfigure() { 147LOGGER.debug("Reconfiguring composite configuration"); 148final List configs = new ArrayList<>(); 149final ConfigurationFactory factory = ConfigurationFactory.getInstance(); 150for (final AbstractConfiguration config : configurations) { 151final ConfigurationSource source = config.getConfigurationSource(); 152final URI sourceURI = source.getURI(); 153Configuration currentConfig; 154if (sourceURI != null) { 155LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", 156config.getName()); 157currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); 158if (currentConfig == null) { 159LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); 160currentConfig = config; 161} 162} else { 163currentConfig = config; 164} 165configs.add((AbstractConfiguration) currentConfig); 166 167} 168 169return new CompositeConfiguration(configs); 170} {code} So it makes sense, because after that it will be tried to reload the configuration again, and if it does not work, I get a warn, otherwise is ok. The changed code might look like this: {code:java} @Override public Configuration reconfigure() { LOGGER.debug("Reconfiguring composite configuration"); final List configs = new ArrayList<>(); final ConfigurationFactory factory = ConfigurationFactory.getInstance(); for (final AbstractConfiguration config : configurations) { final ConfigurationSource source = config.getConfigurationSource(); final URI sourceURI = source.getURI(); if (sourceURI == null) { LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", config.getName()); Configuration currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); if (currentConfig == null) { LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); } else { LOGGER.info("Able to reload configuration {}, changes to it will be completed", config.getName()); configs.add((AbstractConfiguration) currentConfig); } } else { configs.add(config); } } return new CompositeConfiguration(configs); } {code} Your feedback and questions are welcome. Thanks! Best regards, rri was: Hello everybody, I found a possible bug in class CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed. The solution: In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the condition: {code:java} if (sourceURI != null)" --> "if (sourceURI == null) {code} Original code: {code:java} 145@Override 146public Configuration reconfigure() { 147LOGGER.debug("Reconfiguring composite configuration"); 148final List configs = new ArrayList<>(); 149final ConfigurationFactory factory = ConfigurationFactory.getInstance(); 150for (final AbstractConfiguration config : configurations) { 151final ConfigurationSource source = config.getConfigurationSource(); 152final URI sourceURI = source.getURI(); 153Configuration currentConfig; 154if (sourceURI != null) { 155LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", 156config.getName()); 157currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); 158if (currentConfig == null) { 159LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); 160currentConfig = config; 161} 162} else { 163currentConfig = config; 164} 165
[jira] [Updated] (LOG4J2-1912) CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed.
[ https://issues.apache.org/jira/browse/LOG4J2-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] R Ri updated LOG4J2-1912: - Description: Hello everybody, I found a possible bug in class CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed. The solution: In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the condition: {code:java} if (sourceURI != null)" --> "if (sourceURI == null) {code} Original code: {code:java} 145@Override 146public Configuration reconfigure() { 147LOGGER.debug("Reconfiguring composite configuration"); 148final List configs = new ArrayList<>(); 149final ConfigurationFactory factory = ConfigurationFactory.getInstance(); 150for (final AbstractConfiguration config : configurations) { 151final ConfigurationSource source = config.getConfigurationSource(); 152final URI sourceURI = source.getURI(); 153Configuration currentConfig; 154if (sourceURI != null) { 155LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", 156config.getName()); 157currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); 158if (currentConfig == null) { 159LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); 160currentConfig = config; 161} 162} else { 163currentConfig = config; 164} 165configs.add((AbstractConfiguration) currentConfig); 166 167} 168 169return new CompositeConfiguration(configs); 170} {code} So it makes sense, because after that it will be tried to reload the configuration again, and if it does not work, I get a warn, otherwise is ok. The changed code might look like this: {code:java} @Override public Configuration reconfigure() { LOGGER.debug("Reconfiguring composite configuration"); final List configs = new ArrayList<>(); final ConfigurationFactory factory = ConfigurationFactory.getInstance(); for (final AbstractConfiguration config : configurations) { final ConfigurationSource source = config.getConfigurationSource(); final URI sourceURI = source.getURI(); if (sourceURI == null) { LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", config.getName()); Configuration currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); if (currentConfig == null) { LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); } else { LOGGER.info("Able to reload configuration {}, changes to it will be completed", config.getName()); configs.add((AbstractConfiguration) currentConfig); } } else { configs.add(config); } } return new CompositeConfiguration(configs); } {code} Your feedback and questions are welcome. Thanks! Best regards, rri PS: Which criterias must I have to resolve it in the API on my own? was: Hello everybody, I found a possible bug in class CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed. The solution: In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the condition: {code:java} if (sourceURI != null)" --> "if (sourceURI == null) {code} So it makes sense, because after that it will be tried to reload the configuration again, and if it does not work, I get a warn, otherwise is ok. The changed code could be seem like this: {code:java} @Override public Configuration reconfigure() { LOGGER.debug("Reconfiguring composite configuration"); final List configs = new ArrayList<>(); final ConfigurationFactory factory = ConfigurationFactory.getInstance(); for (final AbstractConfiguration config : configurations) { final ConfigurationSource source = config.getConfigurationSource(); final URI sourceURI = source.getURI(); if (sourceURI == null) { LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", config.getName()); Configuration currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); if (currentConfig == null) { LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); } else {
[jira] [Updated] (LOG4J2-1912) CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed.
[ https://issues.apache.org/jira/browse/LOG4J2-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary Gregory updated LOG4J2-1912: - Description: Hello everybody, I found a possible bug in class CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed. The solution: In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the condition: {code:java} if (sourceURI != null)" --> "if (sourceURI == null) {code} So it makes sense, because after that it will be tried to reload the configuration again, and if it does not work, I get a warn, otherwise is ok. The changed code could be seem like this: {code:java} @Override public Configuration reconfigure() { LOGGER.debug("Reconfiguring composite configuration"); final List configs = new ArrayList<>(); final ConfigurationFactory factory = ConfigurationFactory.getInstance(); for (final AbstractConfiguration config : configurations) { final ConfigurationSource source = config.getConfigurationSource(); final URI sourceURI = source.getURI(); if (sourceURI == null) { LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", config.getName()); Configuration currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); if (currentConfig == null) { LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); } else { LOGGER.warn("Able to reload configuration {}, changes to it will be completed", config.getName()); configs.add((AbstractConfiguration) currentConfig); } } else { configs.add(config); } } return new CompositeConfiguration(configs); } {code} Questions or tips are welcome. Best regards, rri PS: Which criterias must I have to resolve it in the API on my own? was: Hello everybody, I found a possible bug in class CompositeConfiguration: Unable to determine URI for configuration. However, the reconfiguration is completed. The solution: In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the condition: "if (sourceURI != null)" --> "if (sourceURI == null)" So it makes sense, because after that it will be tried to reload the configuration again, and if it does not work, I get a warn, otherwise is ok. The changed code could be seem like this: @Override public Configuration reconfigure() { LOGGER.debug("Reconfiguring composite configuration"); final List configs = new ArrayList<>(); final ConfigurationFactory factory = ConfigurationFactory.getInstance(); for (final AbstractConfiguration config : configurations) { final ConfigurationSource source = config.getConfigurationSource(); final URI sourceURI = source.getURI(); if (sourceURI == null) { LOGGER.warn("Unable to determine URI for configuration {}, changes to it will be ignored", config.getName()); Configuration currentConfig = factory.getConfiguration(getLoggerContext(), config.getName(), sourceURI); if (currentConfig == null) { LOGGER.warn("Unable to reload configuration {}, changes to it will be ignored", config.getName()); } else { LOGGER.warn("Able to reload configuration {}, changes to it will be completed", config.getName()); configs.add((AbstractConfiguration) currentConfig); } } else { configs.add(config); } } return new CompositeConfiguration(configs); } Questions or tips are welcome. Best regards, rri PS: Which criterias must I have to resolve it in the API on my own? > CompositeConfiguration: Unable to determine URI for configuration. However, > the reconfiguration is completed. > - > > Key: LOG4J2-1912 > URL: https://issues.apache.org/jira/browse/LOG4J2-1912 > Project: Log4j 2 > Issue Type: Bug > Components: API >Affects Versions: 2.8.1, 2.8.2 >Reporter: R Ri >Priority: Trivial > Fix For: 2.8.2 > > Original Estimate: 1h > Remaining Estimate: 1h > > Hello everybody, > I found a possible bug in class CompositeConfiguration: Unable to determine > URI for configuration. However, the reconfiguration is completed. > The solution: > In line 154, Class CompositeConfiguration [log4j-core-2.8.1.jar] change the > condition: > {code:java} > if