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>
相关推荐
x***r1511 小时前
dbeaver-ce-24.1.3-x86_64-setup安装步骤详解(附DBeaver数据库管理与SQL编写教程)
数据库·sql
伏加特遇上西柚2 小时前
Loki+Alloy+Grafana日志采集部署
java·linux·服务器·spring boot·grafana·prometheus
庞轩px3 小时前
第四篇:SpringBoot自动配置——约定大于配置的底层原理
java·spring boot·后端·spring·自动配置·注解开发
Java&Develop3 小时前
pgsql 根据一个查询sql 生成 修改sql
数据库·sql
@小柯555m3 小时前
MySql(高级查询--查找GPA最高值)
数据库·sql·mysql
黄俊懿4 小时前
复合索引设计指南:最左前缀 & 字段排座次
数据库·sql·mysql·adb·性能优化·dba·db
桃花键神5 小时前
【2026精品项目】基于SpringBoot3+Vue3的旧物置换系统(包含源码+项目文档+SQL脚本+部署教程)
数据库·spring boot·sql·vue
阿明在折腾6 小时前
Spring Boot + Python 混合架构:在线工具平台的后端设计
spring boot
@小柯555m6 小时前
MySql(正则表达式--电话号码格式校验)
数据库·sql·mysql·正则表达式
夕除7 小时前
spring boot --07
数据库·sql