首页 > 数据库技术 > 详细

springboot+mybatis 配置sql打印日志

时间:2019-11-18 16:25:03      阅读:352      评论:0      收藏:0      [点我收藏+]

 

第一种:

配置类型

# 配置slq打印日志
logging.level.com.lawt.repository.mapper=debug
重点:

 #其中   com.lawt.repository.mapper    为MyBatis接口interface包的路径

 

打印出来:

技术分享图片

如果只需要打印

第二种:

java代码类型

 /**
     * 打印 sql
     */
    @Bean
    public PerformanceInterceptor performanceInterceptor() {
        PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
        //格式化sql语句
        Properties properties = new Properties();
        properties.setProperty("format", "false");
        performanceInterceptor.setProperties(properties);
        return performanceInterceptor;
    }

打印:

技术分享图片

springboot+mybatis 配置sql打印日志

原文:https://www.cnblogs.com/mark5/p/11882736.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!