For a SQL db, I could just turn on logging on the driver to see what queries were made... or log them on the server side if I had access to the db server.
How is this accomplished in Cassandra ?
You can do this with QueryLogger.
The QueryLogger provides clients with the ability to log queries executed by the driver, and especially, it allows client to track slow queries, i.e. queries that take longer to complete than a configured threshold in milliseconds.
QueryLogger Example Code
try (Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withCredentials("username", "password").build(); Session session = cluster.connect("test")) {
QueryLogger queryLogger = QueryLogger.builder()
.withConstantThreshold(500)
.build();
cluster.register(queryLogger);
for (Row row : session.execute("select userid, firstname from users limit 10")) {
System.out.println(row);
}
}
Here withConstantThreshold(500) means the query which takes longer than 1000 milliseconds will treat as slow query
A QueryLogger that uses a constant threshold in milliseconds to track slow queries. This implementation is the default and should be preferred to QueryLogger.DynamicThresholdQueryLogger which is still in beta state.
and You need to set your logger level to DEBUG turn Query Logging enable