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

相关推荐
Moshow郑锴2 小时前
sql-pipeline - 基于PostgreSQL的SQL健康检查与发布编排平台
java·sql
Elastic 中国社区官方博客21 小时前
错误最多的服务运行正常:使用 ES|QL 从日志进行根因分析
大数据·运维·数据库·sql·elasticsearch·搜索引擎·全文检索
Seraphina361 天前
DVWA(SQL Injection-High,XSS Reflected-Medium,XSS Stored-Medium)
数据库·经验分享·sql·网络安全·xss
2501_933670791 天前
2027风控策略岗秋招准备:SQL、Excel、建模的优先级与项目路径
人工智能·sql·excel
golang学习记1 天前
Jetbrains 正式官宣:全新AI IDE正式发布!
ide·人工智能·intellij-idea·air
其实防守也摸鱼1 天前
网安自测题:掌握核心知识点的实用练习
linux·运维·服务器·前端·数据库·sql·xss
Shadow(⊙o⊙)1 天前
MySQL C/C++链接MySQL使用
数据库·sql·mysql
Shadow(⊙o⊙)1 天前
mysql为创建普通用户并创建库赋权
数据库·sql·mysql
Seraphina361 天前
SQLI-labs(一)黑盒全流程
sql·安全·web安全
做运维的阿瑞2 天前
多表查询基础:INNER JOIN、LEFT JOIN、RIGHT JOIN
数据库·sql·mysql·算法