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; }

打印:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM