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>
相关推荐
imuliuliang1 天前
存储过程(SQL)
android·数据库·sql
一嘴一个橘子1 天前
sql 的 count、avg
sql
孟意昶1 天前
Doris专题31-SQL手册-基础元素
大数据·数据库·数据仓库·分布式·sql·知识图谱·doris
做个文艺程序员1 天前
流式输出(SSE)在 Spring Boot 中的实现【OpenClAW + Spring Boot 系列 第3篇】
java·spring boot·后端
俺爱吃萝卜1 天前
Spring Boot 3 + JDK 17:新一代微服务架构最佳实践
java·spring boot·架构
做个文艺程序员1 天前
Spring Boot 项目集成 OpenClAW【OpenClAW + Spring Boot 系列 第1篇】
java·人工智能·spring boot·开源
霸道流氓气质1 天前
SpringBoot+LangChain4j+Ollama实现本地大模型语言LLM的搭建、集成和示例流程
java·spring boot·后端
小菜同学爱学习1 天前
夯实基础!MySQL数据类型进阶、约束详解与报错排查
开发语言·数据库·sql·mysql
MegaDataFlowers1 天前
使用SpringBoot+MyBatis+MySQL完成后端的数据库增删改查(CRUD)操作
数据库·spring boot·mybatis
做个文艺程序员1 天前
Spring Boot 封装 OpenClAW 服务层最佳实践【OpenClAW + Spring Boot 系列 第2篇】
java·人工智能·spring boot·开源