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

相关推荐
zzzzzz3102 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
云技纵横4 天前
唯一索引 INSERT 死锁实战:5 秒复现交叉插入的 S 锁循环等待
sql·mysql
摇滚侠6 天前
IDEA 创建 Java 项目 手动整合 SSM 框架
java·ide·intellij-idea
BD_Marathon6 天前
SQL学习指南——视图
数据库·sql
2601_962072556 天前
李梦娇常识4600问|题库|打印版
sql·华为od·华为·c#·华为云·.net·harmonyos
敲个大西瓜6 天前
mybatis拦截器插件实现数据库字段加解密
mybatis
HackTwoHub6 天前
Sqli-Scanner SQL注入SKILL自动化挖掘SQL注入,零依赖自动化SQL注入挖掘,赏金猎人
数据库·人工智能·sql·web安全·网络安全·自动化·系统安全
摇滚侠6 天前
SpringMVC 入门到实战 RESTFul 49-55
java·开发语言·后端·spring·intellij-idea·restful
Volunteer Technology6 天前
Flink Table API与SQL(一)
大数据·sql·flink