13:19:14.437 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener -Application failed to start with classpath: [file:/D:/Software/jdk/jre/lib/charsets.jar, file:/D:/Software/jdk/jre/lib/deploy.jar, file:/D:/Software/jdk/jre/lib/ext/access-bridge-64.jar, file:/D:/Software/jdk/jre/lib/ext/cldrdata.jar, file:/D:/Software/jdk/jre/lib/ext/dnsns.jar, file:/D:/Software/jdk/jre/lib/ext/jaccess.jar, file:/D:/Software/jdk/jre/lib/ext/jfxrt.jar, file:/D:/Software/jdk/jre/lib/ext/localedata.jar, file:/D:/Software/jdk/jre/lib/ext/nashorn.jar, file:/D:/Software/jdk/jre/lib/ext/sunec.jar, file:/D:/Software/jdk/jre/lib/ext/sunjce_provider.jar, file:/D:/Software/jdk/jre/lib/ext/sunmscapi.jar, file:/D:/Software/jdk/jre/lib/ext/sunpkcs11.jar, file:/D:/Software/jdk/jre/lib/ext/zipfs.jar, file:/D:/Software/jdk/jre/lib/javaws.jar, file:/D:/Software/jdk/jre/lib/jce.jar, file:/D:/Software/jdk/jre/lib/jfr.jar, file:/D:/Software/jdk/jre/lib/jfxswt.jar, file:/D:/Software/jdk/jre/lib/jsse.jar, file:/D:/Software/jdk/jre/lib/management-agent.jar, file:/D:/Software/jdk/jre/lib/plugin.jar, file:/D:/Software/jdk/jre/lib/resources.jar, file:/D:/Software/jdk/jre/lib/rt.jar, file:/D:/MyDocument/WebService/demo1/target/classes/, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/2.1.5.RELEASE/spring-boot-starter-thymeleaf-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.5.RELEASE/spring-boot-starter-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot/2.1.5.RELEASE/spring-boot-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.5.RELEASE/spring-boot-autoconfigure-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.5.RELEASE/spring-boot-starter-logging-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/C:/Users/guoxw/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/C:/Users/guoxw/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar, file:/C:/Users/guoxw/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar, file:/C:/Users/guoxw/.m2/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar, file:/C:/Users/guoxw/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar, file:/C:/Users/guoxw/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar, file:/C:/Users/guoxw/.m2/repository/org/thymeleaf/thymeleaf-spring5/3.0.11.RELEASE/thymeleaf-spring5-3.0.11.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/thymeleaf/thymeleaf/3.0.11.RELEASE/thymeleaf-3.0.11.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/attoparser/attoparser/2.0.5.RELEASE/attoparser-2.0.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar, file:/C:/Users/guoxw/.m2/repository/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.4.RELEASE/thymeleaf-extras-java8time-3.0.4.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.5.RELEASE/spring-boot-starter-web-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.5.RELEASE/spring-boot-starter-json-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar, file:/C:/Users/guoxw/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar, file:/C:/Users/guoxw/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8.jar, file:/C:/Users/guoxw/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.8/jackson-datatype-jdk8-2.9.8.jar, file:/C:/Users/guoxw/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.8/jackson-datatype-jsr310-2.9.8.jar, file:/C:/Users/guoxw/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.8/jackson-module-parameter-names-2.9.8.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.5.RELEASE/spring-boot-starter-tomcat-2.1.5.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.19/tomcat-embed-core-9.0.19.jar, file:/C:/Users/guoxw/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.19/tomcat-embed-el-9.0.19.jar, file:/C:/Users/guoxw/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.19/tomcat-embed-websocket-9.0.19.jar, file:/C:/Users/guoxw/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.16.Final/hibernate-validator-6.0.16.Final.jar, file:/C:/Users/guoxw/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar, file:/C:/Users/guoxw/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar, file:/C:/Users/guoxw/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-web/5.1.7.RELEASE/spring-web-5.1.7.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-beans/5.1.7.RELEASE/spring-beans-5.1.7.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-webmvc/5.1.7.RELEASE/spring-webmvc-5.1.7.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-aop/5.1.7.RELEASE/spring-aop-5.1.7.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-context/5.1.7.RELEASE/spring-context-5.1.7.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-expression/5.1.7.RELEASE/spring-expression-5.1.7.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-core/5.1.7.RELEASE/spring-core-5.1.7.RELEASE.jar, file:/C:/Users/guoxw/.m2/repository/org/springframework/spring-jcl/5.1.7.RELEASE/spring-jcl-5.1.7.RELEASE.jar, file:/D:/Software/IntelliJIdea/IntelliJIDEA/lib/idea_rt.jar]
13:19:14.670 [main] ERROR org.springframework.boot.SpringApplication -Application run failed
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:55 - RuntimeException in Action for tag [property] java.lang.StringIndexOutOfBoundsException: String index out of range: 15
ERROR in ch.qos.logback.core.joran.spi.Interpreter@76:32 - no applicable action for [spring-profile], current ElementPath is [[configuration][spring-profile]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@77:59 - no applicable action for [property], current ElementPath is [[configuration][spring-profile][property]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@80:32 - no applicable action for [spring-profile], current ElementPath is [[configuration][spring-profile]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@81:59 - no applicable action for [property], current ElementPath is [[configuration][spring-profile][property]]
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:82)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:292)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:265)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:228)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:201)
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.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.example.demo1.Demo1Application.main(Demo1Application.java:10)
Exception in thread "main" java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:55 - RuntimeException in Action for tag [property] java.lang.StringIndexOutOfBoundsException: String index out of range: 15
ERROR in ch.qos.logback.core.joran.spi.Interpreter@76:32 - no applicable action for [spring-profile], current ElementPath is [[configuration][spring-profile]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@77:59 - no applicable action for [property], current ElementPath is [[configuration][spring-profile][property]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@80:32 - no applicable action for [spring-profile], current ElementPath is [[configuration][spring-profile]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@81:59 - no applicable action for [property], current ElementPath is [[configuration][spring-profile][property]]
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:82)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:292)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:265)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:228)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:201)
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.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.example.demo1.Demo1Application.main(Demo1Application.java:10)
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>logback</contextName>
<!--
<property name="LOG_HOME" value="/gather-logs/"></property>
-->
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger -%msg%n</pattern>
</encoder>
</appender>
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>C:gather-logscrm-info.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>C:gather-logsserver-info-%d{yyyyMMdd}.log.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>5MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>2</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger -%msg%n</Pattern>
</layout>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%date{yyyy-MM-dd HH:mm:ss} | %highlight(%-5level) | %boldYellow(%thread) | %boldGreen(%logger) |
%msg%n
</pattern>
</encoder>
</appender>
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<File>C:gather-logscrm-error.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>C:gather-logsserver-error-%d{yyyyMMdd}.log.%i
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>5MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>2</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger -%msg%n
</Pattern>
</layout>
</appender>
<!-- <logger name="com.example.demo1.controller" level="INFO">-->
<!-- </logger>-->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
<!-- TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF -->
<logger name="org.springframework" level="DEBUG" additivity="true"/>
<logger name="org.apache" level="OFF"/>
<logger name="com.alibaba" level="OFF"/>
<!-- 如果这里设置了additivity=true 代码打印信息向上传递,将打印信息传递到root ,并且自己的appender-ref 也会打印,这样就是打印了俩次日志-->
<logger name="com.example.demo1" level="INFO" additivity="true">
<appender-ref ref="console"/>
</logger>
<!--
<spring-profile name="dev">
<property name="LOG_NAME" value="C:/gather-logs/"></property>
</spring-profile>
<spring-profile name="prd">
<property name="LOG_NAME" value="D:/gather-logs/"></property>
</spring-profile>-->
</configuration>
sping:
profiles:
active: dev
异常:logback-spring.xml 加上 如下的property 加报错?
<property name="LOG_HOME" value="/gather-logs/"></property>
原因?