Reputation: 2161
When using construct of the type
public interface TableNameDAO extends CrudRepository<TableNameModel, String> {
List<TableNameModel> findAll();
}
how do I view the generated CQL query in the console of the spring-boot app when this gets executed?
Thanks
Upvotes: 1
Views: 2376
Reputation: 18119
CQL statements are logged by CqlTemplate
on DEBUG
level. Setting the logger org.springframework.data.cassandra.core.cql
(Spring Data Cassandra 2.0 and later, use org.springframework.cassandra.core
for Spring Data Cassandra 1.5.x) to DEBUG
will report all executed statements:
2018-08-13 11:00:31,468 DEBUG | main | org.springframework.data.cassandra.core.cql.CqlTemplate | Executing CQL Statement [UPDATE user SET a = 'b';] |
Alternatively, you can register a query logger in Cluster
:
Cluster cluster = …;
cluster.register(QueryLogger.builder().build());
Log output of QueryLogger
is logged to loggers like com.datastax.driver.core.QueryLogger.NORMAL
at DEBUG
level.
Upvotes: 1