基于spring boot 日志(logback)報(bào)錯的解決方式
記錄一次報(bào)錯解決方法:
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)錯后,spring boot切換回1.5.9發(fā)現(xià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
再次重啟,問題解決
以上這篇基于spring boot 日志(logback)報(bào)錯的解決方式就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
樹莓派安裝OpenCV3完整過程的實(shí)現(xiàn)
這篇文章主要介紹了樹莓派安裝OpenCV3完整過程的實(shí)現(xiàn),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2019-10-10python爬蟲Mitmproxy安裝使用學(xué)習(xí)筆記
這篇文章主要介紹了python爬蟲Mitmproxy學(xué)習(xí)筆記分享,有需要的朋友可以收藏學(xué)習(xí)下,希望可以對你有所幫助,大家一起共同學(xué)習(xí),共同進(jìn)步2021-09-09Pytorch中expand()的使用(擴(kuò)展某個維度)
這篇文章主要介紹了Pytorch中expand()的使用(擴(kuò)展某個維度),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-07-07使用Python實(shí)現(xiàn)Excel文件轉(zhuǎn)換為SVG格式
SVG(Scalable Vector Graphics)是一種基于XML的矢量圖像格式,這種格式在Web開發(fā)和其他圖形應(yīng)用中非常流行,提供了一種高效的方式來呈現(xiàn)復(fù)雜的矢量圖形,本文將介紹如何使用Python轉(zhuǎn)換Excel文件為SVG格式,需要的朋友可以參考下2024-07-07Python實(shí)現(xiàn)新版正方系統(tǒng)滑動驗(yàn)證碼識別
這篇文章主要介紹了基于Python實(shí)現(xiàn)新版正方系統(tǒng)滑動驗(yàn)證碼識別算法和方案,文中示例代碼對我們的學(xué)習(xí)和工作有一定的幫助,感興趣的可以了解一下2021-12-12