HADOOP-19281. MetricsSystemImpl should not print INFO message in CLI (#7071)

Replaced all LOG.info with LOG.debug

Contributed by Sarveksha Yeshavantha Raju
This commit is contained in:
Sarveksha Yeshavantha Raju 2024-09-27 18:50:11 +05:30 committed by GitHub
parent 3d81dde28b
commit 01401d71ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 19 deletions

View File

@ -26,12 +26,12 @@
import java.nio.charset.StandardCharsets;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.hadoop.thirdparty.com.google.common.base.Joiner;
import org.apache.hadoop.thirdparty.com.google.common.base.Splitter;
import org.apache.hadoop.thirdparty.com.google.common.collect.Iterables;
import org.apache.hadoop.thirdparty.com.google.common.collect.Maps;
@ -106,8 +106,8 @@ static MetricsConfig create(String prefix, String... fileNames) {
/**
* Load configuration from a list of files until the first successful load
* @param conf the configuration object
* @param files the list of filenames to try
* @param prefix The prefix of the configuration.
* @param fileNames the list of filenames to try.
* @return the configuration object
*/
static MetricsConfig loadFirst(String prefix, String... fileNames) {
@ -119,10 +119,7 @@ static MetricsConfig loadFirst(String prefix, String... fileNames) {
fh.setFileName(fname);
fh.load();
Configuration cf = pcf.interpolatedConfiguration();
LOG.info("Loaded properties from {}", fname);
if (LOG.isDebugEnabled()) {
LOG.debug("Properties: {}", toString(cf));
}
LOG.debug("Loaded properties from {}: {}", fname, cf);
MetricsConfig mc = new MetricsConfig(cf, prefix);
LOG.debug("Metrics Config: {}", mc);
return mc;
@ -135,8 +132,7 @@ static MetricsConfig loadFirst(String prefix, String... fileNames) {
throw new MetricsConfigException(e);
}
}
LOG.warn("Cannot locate configuration: tried " +
Joiner.on(",").join(fileNames));
LOG.debug("Cannot locate configuration: tried {}", Arrays.asList(fileNames));
// default to an empty configuration
return new MetricsConfig(new PropertiesConfiguration(), prefix);
}

View File

@ -155,7 +155,7 @@ public synchronized MetricsSystem init(String prefix) {
++refCount;
if (monitoring) {
// in mini cluster mode
LOG.info(this.prefix +" metrics system started (again)");
LOG.debug("{} metrics system started (again)", prefix);
return this;
}
switch (initMode()) {
@ -169,7 +169,7 @@ public synchronized MetricsSystem init(String prefix) {
}
break;
case STANDBY:
LOG.info(prefix +" metrics system started in standby mode");
LOG.debug("{} metrics system started in standby mode", prefix);
}
initSystemMBean();
return this;
@ -188,7 +188,7 @@ public synchronized void start() {
configure(prefix);
startTimer();
monitoring = true;
LOG.info(prefix +" metrics system started");
LOG.debug("{} metrics system started", prefix);
for (Callback cb : callbacks) cb.postStart();
for (Callback cb : namedCallbacks.values()) cb.postStart();
}
@ -202,18 +202,18 @@ public synchronized void stop() {
}
if (!monitoring) {
// in mini cluster mode
LOG.info(prefix +" metrics system stopped (again)");
LOG.debug("{} metrics system stopped (again)", prefix);
return;
}
for (Callback cb : callbacks) cb.preStop();
for (Callback cb : namedCallbacks.values()) cb.preStop();
LOG.info("Stopping "+ prefix +" metrics system...");
LOG.debug("Stopping {} metrics system...", prefix);
stopTimer();
stopSources();
stopSinks();
clearConfigs();
monitoring = false;
LOG.info(prefix +" metrics system stopped.");
LOG.debug("{} metrics system stopped.", prefix);
for (Callback cb : callbacks) cb.postStop();
for (Callback cb : namedCallbacks.values()) cb.postStop();
}
@ -302,7 +302,7 @@ synchronized void registerSink(String name, String desc, MetricsSink sink) {
sinks.put(name, sa);
allSinks.put(name, sink);
sa.start();
LOG.info("Registered sink "+ name);
LOG.debug("Registered sink {}", name);
}
@Override
@ -375,8 +375,7 @@ public void run() {
}
}
}, millis, millis);
LOG.info("Scheduled Metric snapshot period at " + (period / 1000)
+ " second(s).");
LOG.debug("Scheduled Metric snapshot period at {} second(s).", period / 1000);
}
synchronized void onTimerEvent() {
@ -609,7 +608,7 @@ public synchronized boolean shutdown() {
MBeans.unregister(mbeanName);
mbeanName = null;
}
LOG.info(prefix +" metrics system shutdown complete.");
LOG.debug("{} metrics system shutdown complete.", prefix);
return true;
}