基于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的Django框架中生成CSV文件的方法
Jul 22 Python
win10环境下python3.5安装步骤图文教程
Feb 03 Python
Django实现的自定义访问日志模块示例
Jun 23 Python
python 将字符串转换成字典dict的各种方式总结
Mar 23 Python
Python 多个图同时在不同窗口显示的实现方法
Jul 07 Python
seek引发的python文件读写的问题及解决
Jul 26 Python
查看keras各种网络结构各层的名字方式
Jun 11 Python
树莓派升级python的具体步骤
Jul 05 Python
Python 数据的累加与统计的示例代码
Aug 03 Python
解决python3输入的坑——input()
Dec 05 Python
flask框架中的cookie和session使用
Jan 31 Python
Python实现byte转integer
Jun 03 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/06 冲泡冲煮
PHP 第一节 php简介
2012/04/28 PHP
PHP实现根据设备类型自动跳转相应页面的方法
2014/07/24 PHP
smarty半小时快速上手入门教程
2014/10/27 PHP
谈谈php对接芝麻信用踩的坑
2016/12/01 PHP
Laravel框架查询构造器简单示例
2019/05/08 PHP
PHP7新特性
2021/03/09 PHP
从数据结构的角度分析 for each in 比 for in 快的多
2013/07/07 Javascript
利用NodeJS和PhantomJS抓取网站页面信息以及网站截图
2013/11/18 NodeJs
用js闭包的方法实现多点标注冒泡示例
2014/05/29 Javascript
详解JavaScript中的forEach()方法的使用
2015/06/08 Javascript
基于jquery实现鼠标滚轮驱动的图片切换效果
2015/10/26 Javascript
JS实现控制文本框的内容
2016/07/10 Javascript
jquery实现拖动效果
2016/08/10 Javascript
Vue数据驱动模拟实现3
2017/01/11 Javascript
vue分类筛选filter方法简单实例
2017/03/30 Javascript
JS实现动态给标签控件添加事件的方法示例
2017/05/13 Javascript
JavaScript定义函数_动力节点Java学院整理
2017/06/27 Javascript
vue对storejs获取的数据进行处理时遇到的几种问题小结
2018/03/20 Javascript
基于jQuery拖拽事件的封装
2020/11/29 jQuery
详解在Python和IPython中使用Docker
2015/04/28 Python
Python爬取三国演义的实现方法
2016/09/12 Python
详解python3中zipfile模块用法
2018/06/18 Python
对python中数组的del,remove,pop区别详解
2018/11/07 Python
对python制作自己的数据集实例讲解
2018/12/12 Python
Python API自动化框架总结
2019/11/12 Python
python numpy库linspace相同间隔采样的实现
2020/02/25 Python
python实现udp聊天窗口
2020/03/31 Python
用纯CSS3实现网页中常见的小箭头
2017/10/16 HTML / CSS
Merchant 1948澳大利亚:新西兰领先的鞋类和靴子供应商
2018/03/24 全球购物
英国和爱尔兰最大的地毯零售商:Kukoon
2018/12/17 全球购物
伦敦鲜花递送:Flower Station
2021/02/03 全球购物
护士专业推荐信
2013/11/02 职场文书
信息科学与技术专业求职信范文
2014/02/20 职场文书
解决Swagger2返回map复杂结构不能解析的问题
2021/07/02 Java/Android
利用js实现简单开关灯代码
2021/11/23 Javascript