springboot+mybatis 配置sql打印日志

第一种:

配置类型

# 配置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; }

打印:

猜你喜欢

转载自www.cnblogs.com/mark5/p/11882736.html