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>
相关推荐
一个天蝎座 白勺 程序猿8 分钟前
自动SQL优化实战|吃透调优接口+报告配置+统计+索引全流程落地
数据库·sql·sql优化
杨运交1 小时前
[044][Web模块]基于 Google Authenticator 的 TOTP 双因素认证框架设计与实现
spring boot
隐形的萝莉1 小时前
再回到技术面,研究 T-SQL 的 UNION、EXISTS、EXCEPT、INTERSECT 运算符。
数据库·sql
二宝哥2 小时前
springboot项目使用Gradle工具实现依赖版本控制
java·spring boot·后端·gradle·版本
吴声子夜歌2 小时前
SQL进阶——窗口函数进行行间比较
数据库·sql
Tian_Hang3 小时前
Eclipse Mosquitto 安装及介绍
java·运维·服务器·ide·sql·mysql·eclipse
卓怡学长3 小时前
w273基于springboot的智能笔记的开发与应用
java·spring boot·spring·intellij-idea
Kyrie_Li13 小时前
Spring Boot Kafka 生产级配置全解析:从入门到精通
spring boot·后端·kafka
要开心吖ZSH1 天前
MVCC 进阶:快照读 vs 当前读、幻读与 Next-Key Lock
java·数据库·sql·mysql·mvcc