Spring cloud的项目, 默认情况下spring boot使用Logback作为日志实现的框架,
在中加入:( 是你项目的package)
debug=true =DEBUG =DEBUG
然后重启,就可以看到sql日志了:
2017-11-10 13:39:24.225 DEBUG 20868 --- [nio-8762-exec-1] : ==> Preparing: SELECT * FROM T where id = ? 2017-11-10 13:39:24.259 DEBUG 20868 --- [nio-8762-exec-1] : ==> Parameters: 1(String) 2017-11-10 13:39:24.320 DEBUG 20868 --- [nio-8762-exec-1] : <== Total: 1 2017-11-10 13:39:24.321 DEBUG 20868 --- [nio-8762-exec-1] : ==> Preparing: update T SET info = ? where id = ? 2017-11-10 13:39:24.322 DEBUG 20868 --- [nio-8762-exec-1] : ==> Parameters: 你好!!!(String) 2017-11-10 13:39:24.388 DEBUG 20868 --- [nio-8762-exec-1] : <== Updates: 1