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

相关推荐
风跟我说过她4 小时前
SQL 一键转经典 Chen 风格 ER 图:开源 CLI + 在线工具 + Agent Skill
数据库·python·sql·开源·开源软件
ch.ju5 小时前
Java—idea知识:如何创建新项目
java·开发语言·intellij-idea
兀兀术9 小时前
windows下忘记pgsql密码
sql·pgsql
熊文豪9 小时前
OceanBaseVS金仓:一条 SQL 的两条路——KingbaseES 的性能竞争力从哪来
数据库·sql·电科金仓
醉古意10 小时前
给AI一个角色设定
intellij-idea·spring ai
倔强的石头_11 小时前
让 AI 直接查公司数据库?先给 SQL 加三道闸:基于蓝耘 MaaS 的只读查询助手
sql
敲代码的嘎仔11 小时前
互动问答系统实战:两级评论模型、ES 搜索集成、Caffeine 多级缓存全记录
java·开发语言·数据库·elasticsearch·缓存·mybatis·高并发
重生之小比特12 小时前
【Java SE】类和对象(一)
java·ide·intellij-idea
cspttty12 小时前
2026年财务分析岗JD中的Excel、SQL、BI与业务分析要求
大数据·sql·excel
cspttty12 小时前
HR数字化校招准备路线:Excel、SQL、BI和AI工具怎么学
人工智能·sql·excel