基于spring boot 日志(logback)报错的解决方式


Posted in Python onFebruary 20, 2020

记录一次报错解决方法:

No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]

org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'logging.level' to java.util.Map<java.lang.String, java.lang.String>
 at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:250)
 at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:226)
 at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:210)
 at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:166)
 at org.springframework.boot.context.logging.LoggingApplicationListener.setLogLevels(LoggingApplicationListener.java:307)
 at org.springframework.boot.context.logging.LoggingApplicationListener.initializeFinalLoggingLevels(LoggingApplicationListener.java:290)
 at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:238)
 at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
 at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:173)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
 at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
 at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
 at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:361)
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258)
 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]
 at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
 at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194)
 at org.springframework.boot.context.properties.bind.BindConverter$CompositeConversionService.convert(BindConverter.java:162)
 at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:96)
 at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:88)
 at org.springframework.boot.context.properties.bind.MapBinder.bindAggregate(MapBinder.java:67)
 at org.springframework.boot.context.properties.bind.AggregateBinder.bind(AggregateBinder.java:58)
 at org.springframework.boot.context.properties.bind.Binder.lambda$bindAggregate$2(Binder.java:305)
 at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:441)
 at org.springframework.boot.context.properties.bind.Binder$Context.access$100(Binder.java:381)
 at org.springframework.boot.context.properties.bind.Binder.bindAggregate(Binder.java:304)
 at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:262)
 at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221)
 ... 18 common frames omitted

application.yml中的原配置如下:(spring boot版本2.0.4)

logging:
 path: ./logs/
 level: debug

报错后,spring boot切换回1.5.9发现没问题,因此去官网查找

官网:https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-custom-log-levels

看到这部分

26.4 Log Levels

All the supported logging systems can have the logger levels set in the Spring Environment (for example, in application.properties) by using logging.level.<logger-name>=<level> where level is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, or OFF. The root logger can be configured by using logging.level.root.

The following example shows potential logging settings in application.properties:

logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR

看完这部分,将yml改为如下:

logging:
 path: ./logs/
 level:
 root: debug

再次重启,问题解决

以上这篇基于spring boot 日志(logback)报错的解决方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。

Python 相关文章推荐
django通过ajax发起请求返回JSON格式数据的方法
Jun 04 Python
Python Requests 基础入门
Apr 07 Python
python flask实现分页效果
Jun 27 Python
对python添加模块路径的三种方法总结
Oct 16 Python
python linecache 处理固定格式文本数据的方法
Jan 08 Python
python实战串口助手_解决8串口多个发送的问题
Jun 12 Python
Python使用sklearn实现的各种回归算法示例
Jul 04 Python
python opencv捕获摄像头并显示内容的实现
Jul 11 Python
python issubclass 和 isinstance函数
Jul 25 Python
python3的数据类型及数据类型转换实例详解
Aug 20 Python
window7下的python2.7版本和python3.5版本的opencv-python安装过程
Oct 24 Python
python调用HEG工具批量处理MODIS数据的方法及注意事项
Feb 18 Python
Django使用Celery加redis执行异步任务的实例内容
Feb 20 #Python
python logging.basicConfig不生效的原因及解决
Feb 20 #Python
Python3 shutil(高级文件操作模块)实例用法总结
Feb 19 #Python
python logging设置level失败的解决方法
Feb 19 #Python
Python实现病毒仿真器的方法示例(附demo)
Feb 19 #Python
python内打印变量之%和f的实例
Feb 19 #Python
Python 实现日志同时输出到屏幕和文件
Feb 19 #Python
You might like
zend framework框架中url大小写问题解决方法
2014/08/19 PHP
PHP中mysql_field_type()函数用法
2014/11/24 PHP
php生成二维码
2015/08/10 PHP
PHP实现的浏览器检查类
2016/04/11 PHP
Linux php 中文乱码的快速解决方法
2016/05/13 PHP
thinkPHP5.0框架简单配置作用域的方法
2017/03/17 PHP
Smarty模板配置实例简析
2019/07/20 PHP
Prototype使用指南之base.js
2007/01/10 Javascript
jquery实现图片翻页效果
2013/12/23 Javascript
javascript日期格式化示例分享
2014/03/05 Javascript
js获取域名的方法
2015/01/27 Javascript
Js控制滑轮左右滑动实例
2015/02/13 Javascript
JavaScript中pop()方法的使用教程
2015/06/09 Javascript
JS实现自动变化的导航菜单效果代码
2015/09/09 Javascript
基于jquery步骤进度条源码分享
2015/11/12 Javascript
JavaScript面向对象之私有静态变量实例分析
2016/01/14 Javascript
轻松掌握JavaScript策略模式
2016/08/25 Javascript
jQuery选择器实例应用
2017/01/05 Javascript
JavaScript控制输入框中只能输入中文、数字和英文的方法【基于正则实现】
2017/03/03 Javascript
使用nodejs爬取前程无忧前端技能排行
2017/05/06 NodeJs
CSS3结合jQuery实现动画效果及回调函数的实例
2017/12/27 jQuery
Javascript 模拟mvc实现点餐程序案例详解
2020/12/24 Javascript
python微信跳一跳系列之棋子定位颜色识别
2018/02/26 Python
PyCharm代码格式调整方法
2018/05/23 Python
Python3用tkinter和PIL实现看图工具
2018/06/21 Python
PyCharm配置mongo插件的方法
2018/11/30 Python
python设置环境变量的作用整理
2020/02/17 Python
MySQL面试题目集锦
2016/04/14 面试题
水务局局长岗位职责
2013/11/28 职场文书
党的群众路线教育实践活动对照检查材料(个人)
2014/09/24 职场文书
幼儿园小班个人工作总结
2015/02/12 职场文书
教师教育教学随笔
2015/08/15 职场文书
Python 流媒体播放器的实现(基于VLC)
2021/04/28 Python
pytorch 实现多个Dataloader同时训练
2021/05/29 Python
浅谈resultMap的用法及关联结果集映射
2021/06/30 Java/Android
解决Jenkins集成SonarQube遇到的报错问题
2021/07/15 Java/Android