配置logback-spring.xml运行报错

来源:3-2 日志的使用

_Day_Day_Up_

2018-02-22

是要加载什么文件??

老师视频里没加载什么啊,直接运行的,还是老师提前弄好了,

我配置的源代码在最下面,


运行出现的bug:

java.lang.IllegalStateException: Failed to load ApplicationContext


at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)

at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)

at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189)

at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131)

at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)

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:191)

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: java.lang.IllegalStateException: Logback configuration error detected: 

ERROR in ch.qos.logback.core.joran.spi.Interpreter@3:15 - no applicable action for [configration], current ElementPath  is [[configration]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:77 - no applicable action for [appender], current ElementPath  is [[configration][appender]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:62 - no applicable action for [layout], current ElementPath  is [[configration][appender][layout]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:22 - no applicable action for [pattern], current ElementPath  is [[configration][appender][layout][pattern]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@13:24 - no applicable action for [root], current ElementPath  is [[configration][root]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@14:42 - no applicable action for [appender-ref], current ElementPath  is [[configration][root][appender-ref]]

at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:162)

at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:81)

at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:59)

at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:115)

at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:303)

at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:276)

at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239)

at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:212)

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:122)

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:325)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)

at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120)

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)

... 24 more


Disconnected from the target VM, address: '127.0.0.1:64294', transport: 'socket'

Process finished with exit code -1







我配置的源代码:

<?xml version="1.0" encoding="utf-8" ?>

<configration>

   <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
       <layout class="ch.qos.logback.classic.PatternLayout">
           <pattern>
               %d - %msg%n
           </pattern>
       </layout>
   </appender>

   <root level="info">
       <appender-ref ref="consoleLog" />
   </root>

</configration>


写回答

1回答

Meet相识

2018-02-22

这问题应该和日志没关系吧,你把配置文件删了就没事?

0
9
慕粉4307443
回复
_Day_Day_Up_
已经解决了,谢谢
2019-09-13
共9条回复

Spring Boot双版本(1.5/2.1) 打造企业级微信点餐系统

从0到1开发中小型企业级Java应用,并学会迭代重构技巧

6410 学习 · 5247 问题

查看课程