spring boot打印sql语句-mybatis

spring boot打印sql语句-mybatis

概述

当自己编写的程序出现了BUG等等,找了很久

调试运行了几遍到mapper层也进去调试进了源码,非常麻烦

我就想打印出sql语句,好进行解决BUG

方法:

可以在你的application.properties文件里添加代码

logging.level.com.shop=debug

# logging.level.接着就是你需要打印sql语句的包=debug
# 比如我的包是com.shop

打印出的sql语句是这样的

: ==>  Preparing: select id, merchantid, shopName, shopDescription, shopBussinessScope, province, city, businessLicense, createTime, `state` from youfanshop where 1=1 and `state`=? 


 : ==> Parameters: 0(Integer)


 : <==      Total: 2

/**
  *看的出打印的
  *第一行是我们的sql语句
  *第二行就是我们的参数
  *第三行就我们返回的行数
  */

posted @ 2019-10-15 10:34  我的有趣住在无趣里  阅读(1221)  评论(0编辑  收藏  举报