logback.xml 中增加如下配置,打开Debug日志输出。
其中name="com.x.x.mapper" 为mybatis DAO接口包路径
<logger name="com.x.x.mapper" level="DEBUG" />
日志格式如下:
10:17:28.810 [http-nio-9202-exec-4] DEBUG c.a.w.m.W - [debug,137] - ==> Preparing: select count(*) from table where user_id = ?
10:17:28.811 [http-nio-9202-exec-4] DEBUG c.a.w.m.W- [debug,137] - ==> Parameters: 1392(Long)
10:17:28.864 [http-nio-9202-exec-4] DEBUG c.a.w.m.W- [debug,137] - <== Total: 1
更多推荐
springboot中使用logback打印mybatis的sql日志
发布评论