引起条件:

SpringBoot2.0下yml文件配置SLF4j日志输出日志级别

logging:
level: debug

解决方法:

  1. 指定系统包路径
    logging:
    root: debug
  2. 指定自己的包目录
    logging:
    com.tuyrk.test: debug

相关资料:

https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/htmlsingle/#boot-features-custom-log-levels



通过使用logging.level,所有受支持的日志记录系统都可以在Spring环境中(例如,在application.properties中)设置记录器级别。

<logger-name>=<level>其中的Level是跟踪、调试、信息、警告、错误、致命或关闭级别之一。

可以使用logging.level.root配置根记录器。

下面的示例显示了应用程序中潜在的日志记录设置:

logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
java.lang.IllegalStateException: Failed to load ApplicationContext

	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: 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:249)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:225)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:208)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:177)
at org.springframework.boot.context.logging.LoggingApplicationListener.setLogLevels(LoggingApplicationListener.java:338)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeFinalLoggingLevels(LoggingApplicationListener.java:319)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:267)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:229)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:202)
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:75)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
... 24 more
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:177)
at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:98)
at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:90)
at org.springframework.boot.context.properties.bind.MapBinder.bindAggregate(MapBinder.java:65)
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:304)
at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:448)
at org.springframework.boot.context.properties.bind.Binder$Context.access$100(Binder.java:388)
at org.springframework.boot.context.properties.bind.Binder.bindAggregate(Binder.java:303)
at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:261)
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:220)
... 42 more

SpringBoot报错:Failed to load ApplicationContext( Failed to bind properties under 'logging.level')的更多相关文章

  1. SpringBoot升级报错:Failed to bind properties under 'logging.level'

    错误详细信息: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties un ...

  2. sprinbcloud学习之-Failed to bind properties under 'logging.level' to java.util.Map<java.lang.String>

    日志报错,提示Failed to bind properties under 'logging.level' to java.util.Map<java.lang.String>, 原因为 ...

  3. Failed to bind properties under 'logging.level' to java.util.Map<java.lang.String, java.lang.String>

    org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'log ...

  4. SpringBoot报错:Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

    Spring Boot报错:Error starting ApplicationContext. To display the conditions report re-run your applic ...

  5. [bug report] 当springboot报错 找不到类 javax.xml.bind.JAXBException

    <!--以下四个依赖均是javax.xml.bind.JAXBException的依赖 在java6/7/8默认支持,java9不再支持--> <dependency> < ...

  6. SpringBoot报错:Failed to load ApplicationContext(javax.websocket.server.ServerContainer not available)

    引起条件: WebSocket+单元测试,单元测试报错! 解决方法: SpringBootTest增加webEnvironment参数. https://docs.spring.io/spring-b ...

  7. SpringBoot报错:Failed to load ApplicationContext(Mapped Statements collection already contains value)

    错误提示: Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains v ...

  8. junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题

    junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题,说明代码是没问题的,配置也没问题.开始时怀疑是我使用junit版本 ...

  9. Junit 报错: Failed to load ApplicationContext

    今天在使用Junit测试时候,报了个错误: Failed to load ApplicationContext, aspect not found;挺奇怪的 我又没有调用你,之前还好好的,现在不能使用 ...

随机推荐

  1. Python自动化中的元素定位(一)

    1.使用selenium中的webdriver模块对浏览器进行操作 1)from selenium import webdriver 加载模块 2)b = webdriver.Friefox() 打开 ...

  2. centos7 把终端显示改为英文/中文

    把终端显示改为英文: 1.先备份语言配置文件 cp /etc/locale.conf /home/locale.conf.backup 2.打开配置文件 vim /etc/locale.conf 3. ...

  3. R语言︱LDA主题模型——最优主题...

    R语言︱LDA主题模型——最优主题...:https://blog.csdn.net/sinat_26917383/article/details/51547298#comments

  4. PHP斐波那契数列有点不明白有哪位大佬能给讲讲思想以及实现过程

    function Fibonacci($n){         if($n <= 0) {             return 0;         }elseif($n == 1) {    ...

  5. Java Swing 编程 JComboBox 显示不全问题。

    最近在做Java Swing编程一个小例子.然后遇到JComboBox 宽度固定,而下拉列表比较长,导致显示不全的问题. 解决的思路想到两种,1:下拉列表当显示不全的时候,换行显示.2:在下拉列表停几 ...

  6. 解析xml,返回第一级元素键值对。如果第一级元素有子节点,则此节点的值是子节点的xml数据。

    /** 转换成XML格式字符串 **/ public static String doXMLStr(Map<String, String> map) { StringBuffer xml_ ...

  7. adjustsFontSizeToFitWidth 与 NSLineBreakByCharWrapping 无法共用

    newLabel.lineBreakMode = NSLineBreakByCharWrapping; newLabel.text = content; newLabel.adjustsFontSiz ...

  8. .net基础学java系列(七)赶鸭子上架看项目代码

    项目用到的技术栈 序列化 com.alibaba.fastjson.JSON; https://github.com/alibaba/fastjson/wiki/Quick-Start-CN 日志 l ...

  9. [原创]基于Zynq SDIO WIFI 2.4G/5G SotfAP STA

    支持正基WiFi模块.高通WiFi模块: 2.4G速率: 5G AC速率: 支持SoftAP.STA模式:

  10. spark ML pipeline 学习

    一.pipeline 一个典型的机器学习过程从数据收集开始,要经历多个步骤,才能得到需要的输出.这非常类似于流水线式工作,即通常会包含源数据ETL(抽取.转化.加载),数据预处理,指标提取,模型训练与 ...