SpringBoot 项目,三种方式实现打印 sql 日志

方式一:指定mybatis日志级别

复制代码
# application.yml
mybatis:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
# 等价于application.properties
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

方式二、Mybatis-Plus配置(如果用了 Mybatis-Plus )

复制代码
# 开启mybatis-plus自带SQL打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

方式三、mybatis-config.xml 配置(一般是在配置文件中指定了读取 mybatis-config 才这样写)

xml 复制代码
 <configuration>
    <settings>
        <setting name="logImpl" value="STDOUT_LOGGING"/>
    </settings>
</configuration>
相关推荐
Decay__11 小时前
09_MySQL 闪回与时间点恢复 —— binlog 回放、mysqlbinlog、PITR 与误删恢复
运维·数据库·sql·mysql·架构
梦影_13 小时前
MySQL进阶教程(五)—— SQL调优(下)
android·大数据·数据库·后端·sql·mysql·database
学长毕设15 小时前
基于SpringBoot的烘焙商品商品系统-附源码
java·spring boot·后端
howard200516 小时前
英中 / 中英对照制作程序:操作指南
spring boot·bootstrap·thymeleaf·操作指南·对照制作程序
呆萌很19 小时前
达梦(DM8)数据库常用SQL
数据库·sql
跟太阳说早安19 小时前
极简数据库SQL
数据库·sql
CoderYanger19 小时前
Java EE 进阶:5. Spring IoC&DI(第三弹):Spring DI
java·开发语言·spring boot·spring·面试·java-ee·mvc
凤凰院凶涛QAQ20 小时前
《MySQL内核拆解:从SQL到InnoDB》(三) : 数据库设计 & 聚合查询 & 分组查询
数据库·sql·mysql
Decay__21 小时前
01_MySQL 体系架构全解 —— 连接层、SQL 层、存储引擎层与 InnoDB 深入
运维·数据库·sql·mysql·架构
小蒜学长21 小时前
基于SpringBoot 框架的自媒体新闻系统的设计与实现(代码+数据库+LW)
java·spring boot·后端·mysql数据库·自媒体新闻管理系统