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语句问题

相关推荐
阿里云大数据AI技术1 天前
用 SQL 调大模型?Hologres + 百炼,让数据开发直接“对话”AI
sql·llm
tryCbest6 天前
数据库SQL学习
数据库·sql
cowboy2586 天前
mysql5.7及以下版本查询所有后代值(包括本身)
数据库·sql
努力的lpp7 天前
SQL 报错注入
数据库·sql·web安全·网络安全·sql注入
麦聪聊数据7 天前
统一 Web SQL 平台如何收编企业内部的“野生数据看板”?
数据库·sql·低代码·微服务·架构
山峰哥7 天前
吃透 SQL 优化:告别慢查询,解锁数据库高性能
服务器·数据库·sql·oracle·性能优化·编辑器
莫寒清7 天前
Mybatis的插件原理
面试·mybatis
轩情吖7 天前
MySQL初识
android·数据库·sql·mysql·adb·存储引擎
Diligently_7 天前
idea 中vm option 配置
java·ide·intellij-idea
james的分享7 天前
大数据领域核心 SQL 优化框架Apache Calcite介绍
大数据·sql·apache·calcite