Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

tonazeem_142892 avatar image
tonazeem_142892 asked Erick Ramirez answered

How do I enable DEBUG logging just for slow queries?

The debugging level is set at INFO, I want to enable logging of slow running queries for which slow_query_log_timeout_in_ms is set. If debugging level will be set to DEBUG, it will log queries running longer than slow_query_log_timeout_in_ms but at the same time lot of other debugging info will be logged. I do not want any debug info other than slow running query, is it possible to only enable logging of slow running queries and nothing else at debug level?

[cassandra@localhost ~]$ nodetool getlogginglevels
Logger Name                                        Log Level
...
org.apache.cassandra                                    INFO
slow query logging
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

Debug logging is enabled by default since Cassandra 2.2 and goes to debug.log. This is to reduce the "noise" that goes into system.log.

It is possible to disable debug logging by removing the appender in conf/logback.xml but it is not recommended. Debug logs are crucial if you are investigating an issue or need to understand what is going on with your system so it's recommended to always have it on.

If you want to go against best practice, disable debug logging and set the logging level for the class org.apache.cassandra.db.monitoring to DEBUG. Note that this isn't persistent and you will need to set it every time Cassandra is restarted. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.