基于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实现的多线程端口扫描工具分享
Jan 21 Python
Python使用cx_Oracle模块将oracle中数据导出到csv文件的方法
May 16 Python
Python递归遍历列表及输出的实现方法
May 19 Python
Python网站验证码识别
Jan 25 Python
python 实现对数据集的归一化的方法(0-1之间)
Jul 17 Python
详解python3中的真值测试
Aug 13 Python
使用Python抓取豆瓣影评数据的方法
Oct 17 Python
通过python爬虫赚钱的方法
Jan 29 Python
python中with语句结合上下文管理器操作详解
Dec 19 Python
django修改models重建数据库的操作
Mar 31 Python
Python+Appium自动化测试的实战
Jun 30 Python
python开发人人对战的五子棋小游戏
May 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
将数组写入txt文件 var_export
2009/04/21 PHP
laravel学习笔记之模型事件的几种用法示例
2017/08/15 PHP
使用Git实现Laravel项目的自动化部署
2019/11/24 PHP
图片格式的JavaScript和CSS速查手册
2007/08/20 Javascript
js数组操作学习总结
2013/11/04 Javascript
JavaScript数组去重的3种方法和代码实例
2015/07/01 Javascript
jQuery EasyUI Tab 选项卡问题小结
2016/08/16 Javascript
利用jquery实现实时更新歌词的方法
2017/01/06 Javascript
浅谈在vue中用webpack打包之后运行文件的问题以及相关配置方法
2018/02/21 Javascript
jquery实现搜索框功能实例详解
2018/07/23 jQuery
从理论角度讨论JavaScript闭包
2019/04/03 Javascript
JS实现贪吃蛇游戏
2019/11/15 Javascript
js里面的变量范围分享
2020/07/18 Javascript
使用python提取html文件中的特定数据的实现代码
2013/03/24 Python
利用python批量修改word文件名的方法示例
2017/10/17 Python
python实现简易内存监控
2018/06/21 Python
linux安装Python3.4.2的操作方法
2018/09/28 Python
Python PyQt5 Pycharm 环境搭建及配置详解(图文教程)
2019/07/16 Python
在linux系统下安装python librtmp包的实现方法
2019/07/22 Python
python redis 批量设置过期key过程解析
2019/11/26 Python
Django CSRF认证的几种解决方案
2020/03/03 Python
HTML5 3D衣服摇摆动画特效
2016/03/17 HTML / CSS
Gap工厂店:Gap Factory
2017/11/02 全球购物
The Body Shop美体小铺西班牙官网:天然化妆品
2019/06/21 全球购物
会计学应届毕业生推荐信
2013/11/04 职场文书
安全生产检讨书
2014/01/21 职场文书
商场活动策划方案
2014/01/24 职场文书
见习期自我鉴定范文
2014/03/19 职场文书
小学毕业寄语大全
2014/04/03 职场文书
学生自我鉴定格式及范文
2014/09/16 职场文书
有关朝花夕拾的读书笔记
2015/06/29 职场文书
nginx如何将http访问的网站改成https访问
2021/03/31 Servers
Nginx使用X-Accel-Redirect实现静态文件下载的统计、鉴权、防盗链、限速等
2021/04/04 Servers
golang的文件创建及读写操作
2022/04/14 Golang
Android Studio实现简易进制转换计算器
2022/05/20 Java/Android
Spring Boot 的创建和运行示例代码详解
2022/07/23 Java/Android