Max*_*son 5 logging spring log4j gradle spring-boot
好吧,以下代码可以工作,但它看起来并不好看.我有一个Spring Boot项目,我想排除SLF4J,因为我想使用Log4j2.
有谁知道如何改进代码?
dependencies {
compile("org.springframework:spring-context") {
exclude module: "spring-boot-starter-logging"
exclude module: "logback-classic"
}
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-logging"
exclude module: "logback-classic"
}
compile("org.springframework.boot:spring-boot-starter-data-mongodb") {
exclude module: "spring-boot-starter-logging"
exclude module: "logback-classic"
}
compile("org.springframework.boot:spring-boot-starter-log4j2")
providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper")
testCompile("junit:junit")
}
Run Code Online (Sandbox Code Playgroud)
你可以尝试:
dependencies {
[
"org.springframework:spring-context",
"org.springframework.boot:spring-boot-starter-web",
"org.springframework.boot:spring-boot-starter-data-mongodb",
].each { dep ->
compile(dep) {
exclude module: "spring-boot-starter-logging"
exclude module: "logback-classic"
}
}
compile("org.springframework.boot:spring-boot-starter-log4j2")
runtime("org.apache.tomcat.embed:tomcat-embed-jasper")
testCompile("junit:junit")
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7452 次 |
最近记录: |