基于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 相关文章推荐
python使用Queue在多个子进程间交换数据的方法
Apr 18 Python
python MySQLdb Windows下安装教程及问题解决方法
May 09 Python
Python 迭代器工具包【推荐】
May 06 Python
Python脚本实现12306火车票查询系统
Sep 30 Python
浅谈Python浅拷贝、深拷贝及引用机制
Dec 15 Python
python实现Floyd算法
Jan 03 Python
python中数组和矩阵乘法及使用总结(推荐)
May 18 Python
Python空间数据处理之GDAL读写遥感图像
Aug 01 Python
python3 下载网络图片代码实例
Aug 27 Python
Python爬虫解析网页的4种方式实例及原理解析
Dec 30 Python
Python matplotlib画曲线例题解析
Feb 07 Python
python绘图subplots函数使用模板的示例代码
Apr 30 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
收听短波不可能有声音清晰的品质吗
2021/03/01 无线电
在Zeus Web Server中安装PHP语言支持
2006/10/09 PHP
php获取远程文件大小
2015/10/20 PHP
php格式文件打开的四种方法
2018/02/24 PHP
javascript addBookmark 加入收藏 多浏览器兼容
2009/08/15 Javascript
jQuery EasyUI API 中文文档 - EasyLoader 加载器
2011/09/29 Javascript
node.js中的url.format方法使用说明
2014/12/10 Javascript
JavaScript获取表格(table)当前行的值、删除行、增加行
2015/07/03 Javascript
jquery马赛克拼接翻转效果代码分享
2015/08/24 Javascript
jquery中val()方法是从最后一个选项往前读取的
2015/09/06 Javascript
Query常用DIV操作获取和设置长度宽度的实现方法
2016/09/19 Javascript
AngularJS实现DOM元素的显示与隐藏功能
2016/11/22 Javascript
DropDownList实现可输入可选择(两种版本可选)
2016/12/07 Javascript
基于JS实现bookstore静态页面的实例代码
2017/02/22 Javascript
JAVA面试题 static关键字详解
2019/07/16 Javascript
解决layer.confirm选择完之后消息框不消失的问题
2019/09/16 Javascript
小程序选项卡以及swiper套用(跨页面)
2020/06/19 Javascript
electron踩坑之dialog中的callback解决
2020/10/06 Javascript
浅谈pandas中shift和diff函数关系
2018/04/08 Python
解决python 输出是省略号的问题
2018/04/19 Python
python如何删除文件中重复的字段
2019/07/16 Python
python mqtt 客户端的实现代码实例
2019/09/25 Python
Python 装饰器原理、定义与用法详解
2019/12/07 Python
Pycharm配置PyQt5环境的教程
2020/04/02 Python
深入解读CSS3中transform变换模型的渲染
2016/05/27 HTML / CSS
钉钉企业内部H5微应用开发详解
2020/05/12 HTML / CSS
StubHub巴西:购买和出售您的门票
2016/07/22 全球购物
.NET方向面试题
2014/11/20 面试题
城市轨道专业个人求职信范文
2013/09/23 职场文书
财会自我鉴定范文
2013/12/27 职场文书
花坛标语大全
2014/06/30 职场文书
工伤私了协议书范本
2014/11/24 职场文书
个人典型事迹材料
2014/12/30 职场文书
狮子林导游词
2015/02/03 职场文书
街道社区活动报告
2015/02/05 职场文书
赡养老人协议书范本
2015/08/06 职场文书