You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rn...@apache.org on 2017/02/25 00:33:25 UTC
ambari git commit: AMBARI-20190. LogSearch Integration logs repeated
WARN message that should be at DEBUG level. (rnettleton)
Repository: ambari
Updated Branches:
refs/heads/trunk 424949b95 -> 15e3c4889
AMBARI-20190. LogSearch Integration logs repeated WARN message that should be at DEBUG level. (rnettleton)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/15e3c488
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/15e3c488
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/15e3c488
Branch: refs/heads/trunk
Commit: 15e3c48890413bcacbe17075782787ae8b754bad
Parents: 424949b
Author: Bob Nettleton <rn...@hortonworks.com>
Authored: Fri Feb 24 19:32:54 2017 -0500
Committer: Bob Nettleton <rn...@hortonworks.com>
Committed: Fri Feb 24 19:32:54 2017 -0500
----------------------------------------------------------------------
.../logging/LoggingSearchPropertyProvider.java | 10 ++++++++--
.../ambari/server/controller/logging/Utils.java | 14 ++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/15e3c488/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
index 36c485a..a744e0e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
@@ -131,8 +131,14 @@ public class LoggingSearchPropertyProvider implements PropertyProvider {
// add the logging metadata for this host component
resource.setProperty("logging", loggingInfo);
} else {
- Utils.logErrorMessageWithCounter(LOG, errorLogCounterForLogSearchConnectionExceptions,
- "Error occurred while making request to LogSearch service, unable to populate logging properties on this resource");
+ if (LOG.isDebugEnabled()) {
+ String debugMessage =
+ String.format("Error occurred while making request to LogSearch service, unable to populate logging properties on this resource, component = %s, host = %s",
+ componentName, hostName);
+
+ Utils.logDebugMessageWithCounter(LOG, errorLogCounterForLogSearchConnectionExceptions,
+ debugMessage);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/15e3c488/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/Utils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/Utils.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/Utils.java
index 969d442..3350414 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/Utils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/Utils.java
@@ -62,4 +62,18 @@ public class Utils {
atomicInteger.compareAndSet(maxCount, 0);
}
}
+
+ static void logDebugMessageWithCounter(Logger logger, AtomicInteger atomicInteger, String errorMessage) {
+ logDebugMessageWithCounter(logger, atomicInteger, errorMessage, WAIT_COUNT_MAX);
+ }
+
+ static void logDebugMessageWithCounter(Logger logger, AtomicInteger atomicInteger, String debugMessage, int maxCount) {
+ if (atomicInteger.getAndIncrement() == 0) {
+ // only log the message once every maxCount attempts
+ logger.debug(debugMessage);
+ } else {
+ // if we've hit maxCount attempts, reset the counter
+ atomicInteger.compareAndSet(maxCount, 0);
+ }
+ }
}