Jac*_*kie 6 gradle spring-boot
我使用 gradle 并latest.release
到处都是混杂的,但是,最近我的 Spring boot 应用程序停止从命令行运行。当我跑步时gradle clean bootRun
我得到...
线程“main”中出现异常 java.lang.IllegalArgumentException:LoggerFactory 不是 Logback LoggerContext,但 Logback 位于类路径上。删除 Logback 或竞争实现(从文件加载的类 org.slf4j.impl.Log4jLoggerFactory:/.../.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.25/ 110cefe2df103412849d72ef7a67e4e91e4266b4/slf4j-log4j12-1.7.25.jar)。如果您使用WebLogic,则需要将“org.slf4j”添加到WEB-INF/weblogic.xml中的prefer-application-packages中:org.slf4j.impl.Log4jLoggerFactory
根据这篇文章我尝试过...
configurations.all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'org.springframework.boot', module: 'logback-classic'
exclude group: "org.slf4j"
}
Run Code Online (Sandbox Code Playgroud)
这会消除 Logback 错误,但 spring 不会启动并且失败,没有错误。
引起原因:org.gradle.process.internal.ExecException:处理'命令'/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin/java''以非零退出值1完成
我缺少什么?
spring-boot-starter-logging
我有这个并通过排除和logback-classic
添加 spring log4j2 实现来修复它gradle.build
configurations {
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-log4j2:2.2.6.RELEASE'
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
22773 次 |
最近记录: |