基于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读写/追加excel文件Demo分享
May 03 Python
python3实现爬取淘宝美食代码分享
Sep 23 Python
Python动态参数/命名空间/函数嵌套/global和nonlocal
May 29 Python
pandas.DataFrame的pivot()和unstack()实现行转列
Jul 06 Python
python实现的读取网页并分词功能示例
Oct 29 Python
Python浮点数四舍五入问题的分析与解决方法
Nov 19 Python
vue学习笔记之动态组件和v-once指令简单示例
Feb 29 Python
Python运行提示缺少模块问题解决方案
Apr 02 Python
python argparse传入布尔参数false不生效的解决
Apr 20 Python
python 制作网站筛选工具(附源码)
Jan 21 Python
python sleep和wait对比总结
Feb 03 Python
python实现对doc、txt、xls等文档的读写操作
Apr 02 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
php搜索文件程序分享
2015/10/30 PHP
PHP与Web页面的交互示例详解一
2020/08/04 PHP
Code:findPosX 和 findPosY
2006/12/20 Javascript
调整小数的格式保留小数点后两位
2014/05/14 Javascript
jQuery切换网页皮肤并保存到Cookie示例代码
2014/06/16 Javascript
js代码实现的加入收藏效果并兼容主流浏览器
2014/06/23 Javascript
Javascript中神奇的this
2016/01/20 Javascript
jQuery下拉菜单的实现代码
2016/11/03 Javascript
微信小程序 input输入框控件详解及实例(多种示例)
2016/12/14 Javascript
JS禁止浏览器右键查看元素或按F12审查元素自动关闭页面示例代码
2017/09/07 Javascript
vue实现节点增删改功能
2019/09/26 Javascript
[04:30]显微镜下的DOTA2第五期——拉比克
2013/09/26 DOTA
python中的多重继承实例讲解
2014/09/28 Python
初步理解Python进程的信号通讯
2015/04/09 Python
Python基于PycURL自动处理cookie的方法
2015/07/25 Python
Python模拟随机游走图形效果示例
2018/02/06 Python
Python 爬虫之Beautiful Soup模块使用指南
2018/07/05 Python
Jupyter notebook在mac:linux上的配置和远程访问的方法
2019/01/14 Python
在python中利用opencv简单做图片比对的方法
2019/01/24 Python
Python下简易的单例模式详解
2019/04/08 Python
python实现各种插值法(数值分析)
2019/07/30 Python
使用python代码进行身份证号校验的实现示例
2019/11/21 Python
Django框架反向解析操作详解
2019/11/28 Python
JAVA SWT事件四种写法实例解析
2020/06/05 Python
CSS3实现超酷的黑猫警长首页
2016/04/26 HTML / CSS
使用phonegap查找联系人的实现方法
2017/03/31 HTML / CSS
Black Halo官方网站:购买连衣裙、礼服和连体裤
2018/06/13 全球购物
女装和独特珠宝:Sundance Catalog
2018/09/19 全球购物
加热夹克:RAVEAN
2018/10/19 全球购物
一些网络技术方面的面试题
2014/05/01 面试题
中职毕业生自我鉴定
2014/09/13 职场文书
学校领导干部民主生活会整改方案
2014/09/29 职场文书
新郎新娘答谢词
2015/01/04 职场文书
贴吧吧主申请感言
2015/08/03 职场文书
vue-element-admin项目导入和导出的实现
2021/05/21 Vue.js
python神经网络 使用Keras构建RNN训练
2022/05/04 Python