基于spring boot 日志(logback)報(bào)錯(cuò)的解決方式
記錄一次報(bào)錯(cuò)解決方法:
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
報(bào)錯(cuò)后,spring boot切換回1.5.9發(fā)現(xiàn)沒(méi)問(wèn)題,因此去官網(wǎng)查找
看到這部分
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
再次重啟,問(wèn)題解決
以上這篇基于spring boot 日志(logback)報(bào)錯(cuò)的解決方式就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- SpringBoot項(xiàng)目的logback日志配置(包括打印mybatis的sql語(yǔ)句)
- Spring Boot日志技術(shù)logback原理及配置解析
- Spring boot使用logback實(shí)現(xiàn)日志管理過(guò)程詳解
- SpringBoot logback日志框架使用過(guò)程解析
- Spring Boot異步輸出Logback日志方法詳解
- 基于logback 實(shí)現(xiàn)springboot超級(jí)詳細(xì)的日志配置
- Spring Boot整合logback一個(gè)簡(jiǎn)單的日志集成架構(gòu)
- Logback日志存放路徑不統(tǒng)一解決方案
相關(guān)文章
樹(shù)莓派安裝OpenCV3完整過(guò)程的實(shí)現(xiàn)
這篇文章主要介紹了樹(shù)莓派安裝OpenCV3完整過(guò)程的實(shí)現(xiàn),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2019-10-10python爬蟲(chóng)Mitmproxy安裝使用學(xué)習(xí)筆記
這篇文章主要介紹了python爬蟲(chóng)Mitmproxy學(xué)習(xí)筆記分享,有需要的朋友可以收藏學(xué)習(xí)下,希望可以對(duì)你有所幫助,大家一起共同學(xué)習(xí),共同進(jìn)步2021-09-09Pytorch中expand()的使用(擴(kuò)展某個(gè)維度)
這篇文章主要介紹了Pytorch中expand()的使用(擴(kuò)展某個(gè)維度),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-07-07使用Python實(shí)現(xiàn)Excel文件轉(zhuǎn)換為SVG格式
SVG(Scalable Vector Graphics)是一種基于XML的矢量圖像格式,這種格式在Web開(kāi)發(fā)和其他圖形應(yīng)用中非常流行,提供了一種高效的方式來(lái)呈現(xiàn)復(fù)雜的矢量圖形,本文將介紹如何使用Python轉(zhuǎn)換Excel文件為SVG格式,需要的朋友可以參考下2024-07-07Python實(shí)現(xiàn)新版正方系統(tǒng)滑動(dòng)驗(yàn)證碼識(shí)別
這篇文章主要介紹了基于Python實(shí)現(xiàn)新版正方系統(tǒng)滑動(dòng)驗(yàn)證碼識(shí)別算法和方案,文中示例代碼對(duì)我們的學(xué)習(xí)和工作有一定的幫助,感興趣的可以了解一下2021-12-12python防止程序超時(shí)的實(shí)現(xiàn)示例
因?yàn)槟硞€(gè)需求,需要在程序運(yùn)行的時(shí)候防止超時(shí),本文主要介紹了python防止程序超時(shí)的實(shí)現(xiàn)示例,具有一定的參考價(jià)值,感興趣的可以了解一下2023-08-08