Github user mikewalch commented on a diff in the pull request: https://github.com/apache/accumulo/pull/225#discussion_r103942407 --- Diff: server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsConfiguration.java --- @@ -148,46 +148,35 @@ public Configuration getMetricsConfiguration() { } private void loadConfiguration() { - String accumuloConfDir = getEnvironmentConfiguration().getString("ACCUMULO_CONF_DIR"); - if (null != accumuloConfDir) { - // Try to load the metrics properties file - File mFile = new File(accumuloConfDir, metricsFileName); - if (mFile.exists()) { - if (log.isDebugEnabled()) - log.debug("Loading config file: " + mFile.getAbsolutePath()); - try { - xConfig = new XMLConfiguration(mFile); - xConfig.append(getEnvironmentConfiguration()); - xConfig.addConfigurationListener(new MetricsConfigListener()); - xConfig.setReloadingStrategy(new FileChangedReloadingStrategy()); - - // Start a background Thread that checks a property from the XMLConfiguration - // every so often to force the FileChangedReloadingStrategy to fire. - if (null == watcher || !watcher.isAlive()) { - watcher = new MetricsConfigWatcher(); - watcher.start(); - } - notFound = false; - alreadyWarned = false; - } catch (ConfigurationException ce) { - log.error("Error reading accumulo-metrics.xml file."); - notFound = true; - return; - } - } else { - if (!alreadyWarned) - log.warn("Unable to find metrics file: " + mFile.getAbsolutePath()); - alreadyWarned = true; - notFound = true; - return; - } - } else { + URL metricsUrl = MetricsConfiguration.class.getClassLoader().getResource("accumulo-metrics.xml"); + if (metricsUrl == null) { if (!alreadyWarned) - log.warn("ACCUMULO_CONF_DIR variable not found in environment. Metrics collection will be disabled."); + log.warn("accumulo-metrics.xml was not found on classpath. Metrics collection will be disabled."); alreadyWarned = true; --- End diff -- I am not an expert on this code but I think alreadyWarned is there because the loadConfiguration() can be called multiple times.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---