文章详情页
springboot logback调整mybatis日志级别无效的解决
现象
在日志配置文件 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
相关文章:
1. Django 用户认证Auth组件的使用2. Android WebView通过动态的修改js去拦截post请求参数实例3. 在django admin中配置搜索域是一个外键时的处理方法4. Android 实现列表倒计时功能5. spring boot集成mongodb的增删改查的示例代码6. Django 用户登陆访问限制实例 @login_required7. Django中的AutoField字段使用8. 谷歌Chrome浏览器开发者工具教程—JS调试篇9. Django def clean()函数对表单中的数据进行验证操作10. Python基于gevent实现文件字符串查找器
排行榜