【发布时间】:2020-06-18 16:20:28
【问题描述】:
我目前正在从 Java 8 迁移到 Java 11。我正在使用 Spring boot 2.2.7 和 Maven 3.6.1。我能够完美地构建我的项目而没有错误,但是当我尝试启动我的应用程序时,它会引发 logback 错误:
23:54:33,407 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
23:54:33,408 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
23:54:33,408 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/workspace/applicationtest/target/classes/logback.xml]
23:54:33,410 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
23:54:33,410 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/C:/Users/rock/.m2/repository/net/sourceforge/tess4j/tess4j/3.2.1/tess4j-3.2.1.jar!/logback.xml]
23:54:33,410 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/C:/workspace/applicationtest/target/classes/logback.xml]
23:54:33,509 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
23:54:33,517 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:38 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]
23:54:33,517 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:30 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]
23:54:33,517 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@8:58 - no applicable action for [springProperty], current ElementPath is [[configuration][springProfile][springProperty]]
这是我的 pom.xml 的日志记录部分
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
当我还在使用 Java 8 时,它工作得很好。我也尝试过排除 logback,但仍然没有运气。我使用的 jre 是使用 jlink 生成的。
关于如何解决此问题的任何建议?
【问题讨论】:
标签: java spring-boot log4j logback