使用datastax.QueryLogger显示查询值

时间:2018-10-09 10:41:59

标签: cassandra

我在Java中使用com.datastax.driver.core.QueryLogger在Cassandra上显示执行的查询:

        Cluster cluster = new Cluster.Builder().addContactPoints(URL).withPort(PORT)
            .withoutJMXReporting()
            .withoutMetrics()
            .withCredentials("cassandra", "cassandra")
            .build();
    session = cluster.connect();

我得到的日志如下:

2018-10-09 03:24:17 DEBUG NORMAL - [cluster1] [YYYY/127.0.0.1:9042] Query completed normally, took 37 ms: [4 bound values] INSERT INTO client.info (id_client,phone,address,age) VALUES (:id_client,:phone,:address,:age);

是否可以用实际值替换:id_client, :phone, :address, :age

1 个答案:

答案 0 :(得分:2)

如果启用了跟踪,它将显示绑定值。即

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