cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cassandra git commit: Allow to change logging levels based on components
Date Tue, 05 Sep 2017 13:20:28 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk e38015ed1 -> c1f623902


Allow to change logging levels based on components

patch by Stefan Podkowinski; reviewed by Chris Lohfink for CASSANDRA-12696


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c1f62390
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c1f62390
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c1f62390

Branch: refs/heads/trunk
Commit: c1f62390239f792f010feb07b02218062e34cee0
Parents: e38015e
Author: Stefan Podkowinski <stefan.podkowinski@1und1.de>
Authored: Fri Sep 23 10:56:43 2016 +0200
Committer: Stefan Podkowinski <stefan.podkowinski@1und1.de>
Committed: Tue Sep 5 15:16:40 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../tools/nodetool/SetLoggingLevel.java         | 68 ++++++++++++++++++--
 2 files changed, 65 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c1f62390/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 845fced..3fd8ab0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Allow changing log levels via nodetool for related classes (CASSANDRA-12696)
  * Add stress profile yaml with LWT (CASSANDRA-7960)
  * Reduce memory copies and object creations when acting on ByteBufs (CASSANDRA-13789)
  * simplify mx4j configuration (Cassandra-13578)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c1f62390/src/java/org/apache/cassandra/tools/nodetool/SetLoggingLevel.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/nodetool/SetLoggingLevel.java b/src/java/org/apache/cassandra/tools/nodetool/SetLoggingLevel.java
index 94e4e3b..8d9ad90 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/SetLoggingLevel.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/SetLoggingLevel.java
@@ -22,22 +22,82 @@ import io.airlift.airline.Arguments;
 import io.airlift.airline.Command;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
+import com.google.common.collect.Lists;
+
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
 
-@Command(name = "setlogginglevel", description = "Set the log level threshold for a given
class. If both class and level are empty/null, it will reset to the initial configuration")
+@Command(name = "setlogginglevel", description = "Set the log level threshold for a given
component or class. Will reset to the initial configuration if called with no parameters.")
 public class SetLoggingLevel extends NodeToolCmd
 {
-    @Arguments(usage = "<class> <level>", description = "The class to change
the level for and the log level threshold to set (can be empty)")
+    @Arguments(usage = "<component|class> <level>", description = "The component
or class to change the level for and the log level threshold to set. Will reset to initial
level if omitted. "
+        + "Available components:  bootstrap, compaction, repair, streaming, cql, ring")
     private List<String> args = new ArrayList<>();
 
     @Override
     public void execute(NodeProbe probe)
     {
-        String classQualifier = args.size() >= 1 ? args.get(0) : EMPTY;
+        String target = args.size() >= 1 ? args.get(0) : EMPTY;
         String level = args.size() == 2 ? args.get(1) : EMPTY;
-        probe.setLoggingLevel(classQualifier, level);
+
+        List<String> classQualifiers = Collections.singletonList(target);
+        if (target.equals("bootstrap"))
+        {
+            classQualifiers = Lists.newArrayList(
+                    "org.apache.cassandra.gms",
+                    "org.apache.cassandra.hints",
+                    "org.apache.cassandra.schema",
+                    "org.apache.cassandra.service.StorageService",
+                    "org.apache.cassandra.db.SystemKeyspace",
+                    "org.apache.cassandra.batchlog.BatchlogManager",
+                    "org.apache.cassandra.net.MessagingService");
+        }
+        else if (target.equals("repair"))
+        {
+            classQualifiers = Lists.newArrayList(
+                    "org.apache.cassandra.repair",
+                    "org.apache.cassandra.db.compaction.CompactionManager",
+                    "org.apache.cassandra.service.SnapshotVerbHandler");
+        }
+        else if (target.equals("streaming"))
+        {
+            classQualifiers = Lists.newArrayList(
+                    "org.apache.cassandra.streaming",
+                    "org.apache.cassandra.dht.RangeStreamer");
+        }
+        else if (target.equals("compaction"))
+        {
+            classQualifiers = Lists.newArrayList(
+                    "org.apache.cassandra.db.compaction",
+                    "org.apache.cassandra.db.ColumnFamilyStore",
+                    "org.apache.cassandra.io.sstable.IndexSummaryRedistribution");
+        }
+        else if (target.equals("cql"))
+        {
+            classQualifiers = Lists.newArrayList(
+                    "org.apache.cassandra.cql3",
+                    "org.apache.cassandra.auth",
+                    "org.apache.cassandra.batchlog",
+                    "org.apache.cassandra.net.ResponseVerbHandler",
+                    "org.apache.cassandra.service.AbstractReadExecutor",
+                    "org.apache.cassandra.service.AbstractWriteResponseHandler",
+                    "org.apache.cassandra.service.paxos",
+                    "org.apache.cassandra.service.ReadCallback",
+                    "org.apache.cassandra.service.ResponseResolver");
+        }
+        else if (target.equals("ring"))
+        {
+            classQualifiers = Lists.newArrayList(
+                    "org.apache.cassandra.gms",
+                    "org.apache.cassandra.service.PendingRangeCalculatorService",
+                    "org.apache.cassandra.service.LoadBroadcaster",
+                    "org.apache.cassandra.transport.Server");
+        }
+
+        for (String classQualifier : classQualifiers)
+            probe.setLoggingLevel(classQualifier, level);
     }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message