1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | <?xml version= "1.0" encoding= "UTF-8" ?> <configuration> <appender name= "consoleLog" class = "ch.qos.logback.core.ConsoleAppender" > <layout class = "ch.qos.logback.classic.PatternLayout" > <pattern> d% - %msg%n </pattern> </layout> </appender> <appender name= "fileInfoLog" class = "ch.qos.logback.core.rolling.RollingFileAppender" > <enoder> <pattern>%msg%n</pattern> </enoder> <!--滚动策略--> <rollingPolicy classs= "ch.qos.logback.core.rolling.TimeBasedRollingPolicy" > <!--路径--> <fileNamePattern> /Users/weichangda/Desktop/practice/log/sell/info.%d.log </fileNamePattern> </rollingPolicy> </appender> <root level= "info" > <!--<appender-ref ref= "consoleLog" />--> <appender-ref ref= "fileInfoLog" /> </root> </configuration> 报错信息: 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: 51 ) 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 @8 : 18 - RuntimeException in Action for tag [layout] java.lang.NumberFormatException: For input string: " - %" ERROR in ch.qos.logback.core.ConsoleAppender[consoleLog] - No encoder set for the appender named "consoleLog" . ERROR in ch.qos.logback.core.joran.spi.Interpreter @11 : 17 - no applicable action for [enoder], current ElementPath is [[configuration][appender][enoder]] ERROR in ch.qos.logback.core.joran.spi.Interpreter @12 : 22 - no applicable action for [pattern], current ElementPath is [[configuration][appender][enoder][pattern]] ERROR in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Could not find an appropriate class for property [rollingPolicy] ERROR in ch.qos.logback.core.joran.spi.Interpreter @17 : 30 - no applicable action for [fileNamePattern], current ElementPath is [[configuration][appender][rollingPolicy][fileNamePattern]] 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.invokeListener(SimpleApplicationEventMulticaster.java: 167 ) 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 Process finished with exit code 255 |