基于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 dict 字典 以及 赋值 引用的一些实例(详解)
Jan 20 Python
致Python初学者 Anaconda入门使用指南完整版
Apr 05 Python
python的debug实用工具 pdb详解
Jul 12 Python
sklearn-SVC实现与类参数详解
Dec 10 Python
如何配置关联Python 解释器 Anaconda的教程(图解)
Apr 30 Python
如何写python的配置文件
Jun 07 Python
pycharm软件实现设置自动保存操作
Jun 08 Python
使用Keras训练好的.h5模型来测试一个实例
Jul 06 Python
Python三维绘图之Matplotlib库的使用方法
Sep 20 Python
scrapy处理python爬虫调度详解
Nov 23 Python
Jupyter Notebook内使用argparse报错的解决方案
Jun 03 Python
Python+Tkinter打造签名设计工具
Apr 01 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
无线电广播的开始
2002/01/30 无线电
php curl post 时出现的问题解决
2014/01/30 PHP
php中运用http调用的GET和POST方法示例
2014/09/29 PHP
PHP利用Socket获取网站的SSL证书与公钥
2017/06/18 PHP
对于Laravel 5.5核心架构的深入理解
2018/02/22 PHP
让div层随鼠标移动的实现代码 ie ff
2009/12/18 Javascript
jQuery向上遍历DOM树之parents(),parent(),closest()之间的区别
2013/12/02 Javascript
js抽奖实现随机抽奖代码效果
2013/12/02 Javascript
javascript适合移动端的日期时间拾取器
2015/11/10 Javascript
JS DOM实现鼠标滑动图片效果
2020/09/17 Javascript
jQuery实现的省市县三级联动菜单效果完整实例
2016/08/01 Javascript
Angular和百度地图的结合实例代码
2016/10/19 Javascript
js入门之Function函数的使用方法【新手必看】
2016/11/22 Javascript
JS中parseInt()和map()用法分析
2016/12/16 Javascript
Bootstrap modal 多弹窗之叠加显示不出弹窗问题的解决方案
2017/02/23 Javascript
layui动态加载多表头的实例
2019/09/05 Javascript
JS实现transform实现扇子效果
2020/01/17 Javascript
[43:49]LGD vs CHAOS 2019国际邀请赛小组赛 BO2 第一场 8.15
2019/08/16 DOTA
Python中函数的参数定义和可变参数用法实例分析
2015/06/04 Python
编写Python小程序来统计测试脚本的关键字
2016/03/12 Python
详解Python3中字符串中的数字提取方法
2017/01/14 Python
对python捕获ctrl+c手工中断程序的两种方法详解
2018/12/26 Python
Python函数装饰器常见使用方法实例详解
2019/03/30 Python
Django的ListView超详细用法(含分页paginate)
2020/05/21 Python
python opencv实现直线检测并测出倾斜角度(附源码+注释)
2020/12/31 Python
Python 求向量的余弦值操作
2021/03/04 Python
初中语文教学反思
2014/02/02 职场文书
电焊工岗位工作职责
2014/07/09 职场文书
房屋财产继承协议书范本
2014/11/03 职场文书
2015大学自主招生自荐信范文
2015/03/04 职场文书
2015年酒店工作总结
2015/04/28 职场文书
2015年客房服务员工作总结
2015/05/15 职场文书
2016见义勇为事迹材料汇总
2016/03/01 职场文书
导游词之京东大峡谷旅游区
2019/10/29 职场文书
python中sys模块的介绍与实例
2021/04/17 Python
Go Grpc Gateway兼容HTTP协议文档自动生成网关
2022/06/16 Golang