Spring Boot MyBatis 及 MyBatis-Plus 打印执行 SQL 语句
MyBatis MyBatis-Plus Spring Boot About 414 words方式一(推荐)
application.yaml配置文件中添加相关配置。
MyBatis
mybatis:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
MyBatis-Plus
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
方式二
application.yaml配置文件中指定包路径下的日志级别为debug。
logging:
  level:
    root: info
    com.example.test.mapper: debug
备注
推荐使用方式一,因为在启用了一级缓存时方式二也会打印SQL,会造成误解。
而方式一的配置,则只有在真正执行SQL时输出相应的语句。
                Views: 2,754 · Posted: 2024-08-28
            
            ————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
 
        Loading...