To enable logging for cassandra queries with Spring Data and the datastax driver you first need to register a QueryLogger instance with your cluster:
1 2 | QueryLogger queryLogger = QueryLogger.builder().build(); cluster.register(queryLogger); |
You also need to specify the log levels for the QueryLogger in your properties:
1 2 3 | logging.level.com.datastax.driver.core.QueryLogger.NORMAL=DEBUG logging.level.com.datastax.driver.core.QueryLogger.SLOW=DEBUG logging.level.com.datastax.driver.core.QueryLogger.ERROR=DEBUG |
While you might not always to turn logging on for NORMAL or even SLOW it can ease debugging a lot.