nodetool setlogginglevel
Changes the logging level for a class or package at runtime.
Synopsis
Section titled “Synopsis”nodetool [connection_options] setlogginglevel [<class|component>] [<level>]See connection options for connection options.
Description
Section titled “Description”nodetool setlogginglevel dynamically changes the logging level for a specific Java class, package, or built-in component without restarting Cassandra. This is useful for debugging issues in production.
Non-Persistent Setting
This setting is applied at runtime only and does not persist across node restarts. After a restart, the logging levels revert to the configuration in logback.xml.
Reset All Loggers
Calling nodetool setlogginglevel with no arguments resets all logging levels to the initial configuration from logback.xml.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
class | Fully qualified class name, package, or built-in component name. If omitted with level, resets all loggers |
level | Log level: TRACE, DEBUG, INFO, WARN, ERROR, OFF. If omitted, resets the specified logger |
Built-in Component Shortcuts
Section titled “Built-in Component Shortcuts”The command supports component shortcuts that map to predefined logger sets:
| Component | Description | Mapped Loggers |
|---|---|---|
bootstrap | Bootstrap operations | Bootstrap-related loggers |
compaction | Compaction operations | org.apache.cassandra.db.compaction |
repair | Repair operations | org.apache.cassandra.repair |
streaming | Streaming operations | org.apache.cassandra.streaming |
cql | CQL query handling | CQL transport loggers |
ring | Ring/token management | Ring-related loggers |
Log Levels
Section titled “Log Levels”| Level | Description |
|---|---|
TRACE | Most verbose; detailed tracing information |
DEBUG | Debugging information |
INFO | Informational messages (default) |
WARN | Warning messages |
ERROR | Error messages only |
OFF | Disable logging |
Examples
Section titled “Examples”Enable Debug for Compaction
Section titled “Enable Debug for Compaction”nodetool setlogginglevel org.apache.cassandra.db.compaction DEBUGEnable Debug for Gossip
Section titled “Enable Debug for Gossip”nodetool setlogginglevel org.apache.cassandra.gms DEBUGEnable Debug for Repair
Section titled “Enable Debug for Repair”nodetool setlogginglevel org.apache.cassandra.repair DEBUGEnable Debug for All Cassandra Classes
Section titled “Enable Debug for All Cassandra Classes”nodetool setlogginglevel org.apache.cassandra DEBUGEnable Trace for Specific Class
Section titled “Enable Trace for Specific Class”nodetool setlogginglevel org.apache.cassandra.db.compaction.CompactionManager TRACEDisable Logging for Noisy Class
Section titled “Disable Logging for Noisy Class”nodetool setlogginglevel org.apache.cassandra.transport.messages OFFReset to Default (INFO)
Section titled “Reset to Default (INFO)”nodetool setlogginglevel org.apache.cassandra.db.compaction INFOReset All Loggers to Initial Configuration
Section titled “Reset All Loggers to Initial Configuration”# No arguments resets all loggersnodetool setlogginglevelReset Specific Logger
Section titled “Reset Specific Logger”# Omit level to reset a specific loggernodetool setlogginglevel org.apache.cassandra.db.compactionUsing Component Shortcuts
Section titled “Using Component Shortcuts”# Enable DEBUG for compaction using component shortcutnodetool setlogginglevel compaction DEBUG
# Enable DEBUG for repairnodetool setlogginglevel repair DEBUG
# Enable DEBUG for streamingnodetool setlogginglevel streaming DEBUGCommon Debug Targets
Section titled “Common Debug Targets”Compaction Issues
Section titled “Compaction Issues”nodetool setlogginglevel org.apache.cassandra.db.compaction DEBUGRepair Problems
Section titled “Repair Problems”nodetool setlogginglevel org.apache.cassandra.repair DEBUGnodetool setlogginglevel org.apache.cassandra.streaming DEBUGGossip/Cluster Issues
Section titled “Gossip/Cluster Issues”nodetool setlogginglevel org.apache.cassandra.gms DEBUGnodetool setlogginglevel org.apache.cassandra.net DEBUGRead/Write Path
Section titled “Read/Write Path”nodetool setlogginglevel org.apache.cassandra.db DEBUGnodetool setlogginglevel org.apache.cassandra.service DEBUGAuthentication Issues
Section titled “Authentication Issues”nodetool setlogginglevel org.apache.cassandra.auth DEBUGCQL Protocol
Section titled “CQL Protocol”nodetool setlogginglevel org.apache.cassandra.transport DEBUGHinted Handoff
Section titled “Hinted Handoff”nodetool setlogginglevel org.apache.cassandra.hints DEBUGViewing Changed Levels
Section titled “Viewing Changed Levels”nodetool getlogginglevelsShows all loggers with non-default levels.
Workflow: Debug an Issue
Section titled “Workflow: Debug an Issue”# 1. Enable debug logging for relevant componentnodetool setlogginglevel org.apache.cassandra.db.compaction DEBUG
# 2. Reproduce the issuenodetool compact my_keyspace my_table
# 3. Check logstail -f /var/log/cassandra/debug.log
# 4. Reset logging levelnodetool setlogginglevel org.apache.cassandra.db.compaction INFOLog Output Location
Section titled “Log Output Location”Debug/trace logs typically go to:
/var/log/cassandra/debug.logCheck logback.xml for exact configuration.
Important Considerations
Section titled “Important Considerations”Performance Impact
- DEBUG and TRACE levels generate significant log volume
- May impact performance on busy clusters
- May fill disk quickly
- Always reset after debugging
Best Practices
Section titled “Best Practices”- Be specific - Target specific classes, not broad packages
- Time-limited - Enable only for debugging duration
- Monitor disk - Debug logs grow fast
- Reset promptly - Return to INFO when done
Scripting Example
Section titled “Scripting Example”#!/bin/bash# debug_compaction.sh - Enable debug, wait, then reset
DURATION=${1:-60} # Default 60 seconds
echo "Enabling compaction debug logging for $DURATION seconds..."nodetool setlogginglevel org.apache.cassandra.db.compaction DEBUG
sleep $DURATION
echo "Resetting to INFO..."nodetool setlogginglevel org.apache.cassandra.db.compaction INFO
echo "Done. Check /var/log/cassandra/debug.log"Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| getlogginglevels | View current logging levels |
| info | Node information |
| compactionstats | Alternative to debug logs |