2017-06-04 86 views
0

我在我的春季啓動項目中使用Spring Boot Data Cassandra,我試圖記錄CQL查詢但設置spring.jpa.show-sqltrue不起作用。 這裏是我的application.properties春季啓動不記錄CQL查詢

spring.data.cassandra.keyspace-name=sample 
spring.data.cassandra.contact-points=127.0.0.1 
spring.data.cassandra.port=9042 
spring.data.cassandra.schema-action=CREATE_IF_NOT_EXISTS 
spring.jpa.show-sql=true 

回答

0

它使用LatencyTracker

@SpringBootApplication 
public class Application implements CommandLineRunner { 

    @Autowired 
    public Application(Cluster cluster) { 
     this.cluster = cluster; 
    } 

    @Override 
    public void run(String... strings) throws Exception { 

    cluster.register(new LatencyTracker() { 
       @Override 
       public void update(Host host, Statement statement, Exception exception, long newLatencyNanos) { 
        System.out.println(statement); 
       } 

       @Override 
       public void onRegister(Cluster cluster) { 

       } 

       @Override 
       public void onUnregister(Cluster cluster) { 

       } 
      }); 
    } 

} 
0

不知道你這是從JPA財產期待。

根據當前啓動docs,沒有這樣的屬性可以顯示執行的查詢。

但是,您可以使用本機日誌記錄實施解釋here

+0

請提高通過添加示例代碼你的答案是可能的。 – Mojtabye

+0

爲什麼你不檢查第二個鏈接?代碼在那裏,你必須複製並粘貼它。你的問題是什麼? – galovics