idea 如何开启mybatis控制台SQL日志打印

开启

application.yaml

yaml 复制代码
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

mybatis:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    map-underscore-to-camel-case: true
  typeAliasesPackage: XXXX
  mapper-locations: classpath*:**/xml/*Mapper.xml

application.properties

yaml 复制代码
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

关闭

application.yaml

yaml 复制代码
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl

application.properties

java 复制代码
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.nologging.NoLoggingImpl

StdOutImpl 只是 mybatis 的一种日志实现, mybatis还有多种日志实现

如何知道现在使用的哪种方式?

在项目启动时,会在控制台直接打印如下提示:

java 复制代码
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.

参考

mybatis-plus 开启与关闭 SQL 日志打印
使用springboot默认的日志系统logback打印Mybatis语句问题

相关推荐
January120716 分钟前
IDEA 快捷键
java·ide·intellij-idea
xcLeigh16 分钟前
KES数据库运维监控与故障排查实战
运维·数据库·sql·故障排查·运维监控·kes
yuzhiboyouye39 分钟前
原生 SQL 常用核心语句基础语法
数据库·sql·oracle
biass1 小时前
MyBatis-Plus 实现精准、模糊、批量搜索
mybatis
程序猿乐锅2 小时前
【MySQL | 第五篇】 MySQL 性能分析:如何查询慢 SQL
java·sql·mysql
阿里云大数据AI技术3 小时前
最佳实践:用 EMR Serverless StarRocks AI Function 实现金融行业文本分类_
starrocks·人工智能·sql·阿里云·ai function
土狗TuGou3 小时前
SQL内功笔记 · 第9篇:UPDATE FROM 进阶——告别逐行子查询,拥抱集合更新
java·数据库·笔记·sql·mysql
有梦想的程序星空3 小时前
【环境配置】IDEA+Scala 项目 JAR 打包异常完整排查指南
java·ide·intellij-idea
XiYang-DING4 小时前
【MyBatis】注释方式实现CRUD
mybatis
XiYang-DING4 小时前
【MyBatis】XML方式实现CRUD
xml·mybatis