You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2015/05/04 18:45:22 UTC
[4/5] cassandra git commit: backport 9029 to 2.1
backport 9029 to 2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e6f02797
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e6f02797
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e6f02797
Branch: refs/heads/trunk
Commit: e6f027979a3ec4221438bd2a21db8053cb3c1ad7
Parents: 8ec1da2
Author: T Jake Luciani <ja...@apache.org>
Authored: Mon May 4 12:42:10 2015 -0400
Committer: T Jake Luciani <ja...@apache.org>
Committed: Mon May 4 12:42:10 2015 -0400
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cassandra/utils/NoSpamLoggerTest.java | 141 ++++++++++++++++++-
2 files changed, 139 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f02797/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0593e2b..e7689ab 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.6
+ * Add support for rate limiting log messages (CASSANDRA-9029)
* Log the partition key with tombstone warnings (CASSANDRA-8561)
* Reduce runWithCompactionsDisabled poll interval to 1ms (CASSANDRA-9271)
* Fix PITR commitlog replay (CASSANDRA-9195)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f02797/test/unit/org/apache/cassandra/utils/NoSpamLoggerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/utils/NoSpamLoggerTest.java b/test/unit/org/apache/cassandra/utils/NoSpamLoggerTest.java
index 0a5a005..0d6c8b1 100644
--- a/test/unit/org/apache/cassandra/utils/NoSpamLoggerTest.java
+++ b/test/unit/org/apache/cassandra/utils/NoSpamLoggerTest.java
@@ -32,34 +32,169 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
-import org.slf4j.helpers.SubstituteLogger;
+import org.slf4j.helpers.MarkerIgnoringBase;
public class NoSpamLoggerTest
{
Map<Level, Queue<Pair<String, Object[]>>> logged = new HashMap<>();
- Logger mock = new SubstituteLogger(null)
+ Logger mock = new MarkerIgnoringBase()
{
+ public boolean isTraceEnabled()
+ {
+ return false;
+ }
+
+ public void trace(String s)
+ {
+
+ }
+
+ public void trace(String s, Object o)
+ {
+
+ }
+
+ public void trace(String s, Object o, Object o1)
+ {
+
+ }
+
+ public void trace(String s, Object... objects)
+ {
+
+ }
+
+ public void trace(String s, Throwable throwable)
+ {
+
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return false;
+ }
+
+ public void debug(String s)
+ {
+
+ }
+
+ public void debug(String s, Object o)
+ {
+
+ }
+
+ public void debug(String s, Object o, Object o1)
+ {
+
+ }
+
+ public void debug(String s, Object... objects)
+ {
+
+ }
+
+ public void debug(String s, Throwable throwable)
+ {
+
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return false;
+ }
+
+ public void info(String s)
+ {
+
+ }
+
+ public void info(String s, Object o)
+ {
+
+ }
+
+ public void info(String s, Object o, Object o1)
+ {
+
+ }
+
@Override
public void info(String statement, Object... args)
{
logged.get(Level.INFO).offer(Pair.create(statement, args));
}
+ public void info(String s, Throwable throwable)
+ {
+
+ }
+
+ public boolean isWarnEnabled()
+ {
+ return false;
+ }
+
+ public void warn(String s)
+ {
+
+ }
+
+ public void warn(String s, Object o)
+ {
+
+ }
+
@Override
public void warn(String statement, Object... args)
{
logged.get(Level.WARN).offer(Pair.create(statement, args));
}
+ public void warn(String s, Object o, Object o1)
+ {
+
+ }
+
+ public void warn(String s, Throwable throwable)
+ {
+
+ }
+
+ public boolean isErrorEnabled()
+ {
+ return false;
+ }
+
+ public void error(String s)
+ {
+
+ }
+
+ public void error(String s, Object o)
+ {
+
+ }
+
+ public void error(String s, Object o, Object o1)
+ {
+
+ }
+
@Override
public void error(String statement, Object... args)
{
logged.get(Level.ERROR).offer(Pair.create(statement, args));
}
+ public void error(String s, Throwable throwable)
+ {
+
+ }
+
@Override
public int hashCode()
{
@@ -123,7 +258,7 @@ public class NoSpamLoggerTest
now += 5;
- NoSpamLogger.log( mock, l, 5, TimeUnit.NANOSECONDS, statement, param);
+ NoSpamLogger.log(mock, l, 5, TimeUnit.NANOSECONDS, statement, param);
assertEquals(2, logged.get(l).size());
}