美文网首页spring boot
spring boot如何打印mybatis的执行sql

spring boot如何打印mybatis的执行sql

作者: 大浪滔滔 | 来源:发表于2018-01-09 16:48 被阅读8089次

    方案一

    在application.yml中增加配置,在控制台打印sql:

    mybatis
      configuration:
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 
    

    参考类:org.apache.ibatis.session.Configuration
    log-impl指定的值为org.apache.ibatis.logging.Log接口的某个实现类:


    image.png

    其他配置参考官方说明

    方案二

    在application.yml中增加配置,指定mapper文件所在的包,如:

    logging:
      level:
        io.prong.oauth.service.dao: trace # 改成你的mapper文件所在包路径
    

    相关文章

      网友评论

      本文标题:spring boot如何打印mybatis的执行sql

      本文链接:https://www.haomeiwen.com/subject/anhgnxtx.html