RANGER-246 Incorporated review feedback Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/0d847939 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/0d847939 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/0d847939
Branch: refs/heads/tag-policy Commit: 0d8479394c4912d18ccad61979cd4e9bb8cc6713 Parents: 48a2cd1 Author: Don Bosco Durai <[email protected]> Authored: Tue May 26 12:40:01 2015 -0700 Committer: Don Bosco Durai <[email protected]> Committed: Tue May 26 12:40:01 2015 -0700 ---------------------------------------------------------------------- .../ranger/plugin/service/RangerBasePlugin.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0d847939/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java index 8131ab6..7af103d 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java @@ -308,20 +308,28 @@ public class RangerBasePlugin { LogHistory log = logHistoryList.get(message); if (log == null) { log = new LogHistory(); - log.message = message; - log.lastLogTime = 0; + logHistoryList.put(message, log); } + log.lifetimeCounter++; if ((System.currentTimeMillis() - log.lastLogTime) > logInterval) { log.lastLogTime = System.currentTimeMillis(); + int counter = log.counter; + log.counter = 0; + if( counter > 0) { + message += ". Messages suppressed before: " + counter; + } LOG.error(message); return true; + } else { + log.counter++; } return false; } - class LogHistory { - long lastLogTime; - String message; + static class LogHistory { + long lastLogTime = 0; + int counter=0; + int lifetimeCounter = 0; } }
