目录
1、使用场景
应为在开发过程之中跟踪后端SQL语句,因什么原因导致的错误。需要在Debug过程之中打印出执行的SQL语句。所以需要配置一下SpringBoot之中,Mybatis打印SQL语句。
2、具体实现
application.properties(yml)中配置的两种方式:
1. logging.level.dao包名(dao package)=debug
2. mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
2.1、方案一 打印所有mybatis SQL
一下是yaml文件配置,properties文件翻译一下即可
mybatis
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
2.2、指定mapper文件所在的包
logging:
level:
cn.com.demos.*.mapper: trace # 改成你的mapper文件所在包路径