Search code examples
javaspringcassandracassandra-2.1spring-data-cassandra

Cassandra query logging through spring configuration


is there any easy way to turn on query logging on cassandra through xml configuration? I'm using namespace:

xmlns:cassandra="http://www.springframework.org/schema/data/cassandra"

but I can't find any suitable solution. I was trying to turn on trace through cqlsh, but it dosen't work for my app.

I was trying also to add line:

<logger name="com.datastax.driver.core.QueryLogger.NORMAL" level="TRACE" />

But also doesn't work.

My versions: spring-data-cassandra-1.4.0 cassandra: 2.1.5


Solution

  • Please check out this link and check if you added the query logger to your cluster definition like stated:

    Cluster cluster = ...
    QueryLogger queryLogger = QueryLogger.builder(cluster)
        .withConstantThreshold(...)
        .withMaxQueryStringLength(...)
    .build();
    cluster.register(queryLogger);
    

    Let me know if it helped.