文章詳情頁
springboot logback調整mybatis日志級別無效的解決
瀏覽:3日期:2023-04-14 16:00:11
現象
在日志配置文件 logback-spring.xml 中,無論怎么修改級別,mybatis 的 sql 日志都會打印出來。
原因
在 application.yml 中配置了 mybatis 的自定義日志類,如下:
mybatis: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
點進去查看源碼,發現 debug 日志級別始終為 true,所以怎么配置都不生效
public boolean isDebugEnabled() { return true;}public boolean isTraceEnabled() { return true;}
解決方法
屏蔽 application.yml 中配置的 mybatis 自定義日志類,然后在 logback-spring.xml 配置文件中,將 mapper(及 dao)包,配置為 info 級別。
<!-- 修改其他包的日志輸出級別 --><logger name='com.xxx.xxx.mapper' level='INFO'/>
到此這篇關于springboot logback調整mybatis日志級別無效的解決的文章就介紹到這了,更多相關springboot 調整日志級別無效內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!
標簽:
Spring
相關文章:
排行榜