如何解决Spring Webflux与Log4j2
有关Spring Webflux和Log4j2结合的快速问题。 出于组织原因,我必须将Spring Webflux 与log4j2 一起使用。如果他们在项目中看不到log4j2.xml,我们的支持团队甚至会拒绝支持该应用程序。
请,我的问题不是要挑战这一点,我喜欢我的支持团队以及制定此规则的人。无论如何,我来到这里都是一个真正的问题,为什么我的应用程序不是log4j2?
那样,我的意思是我可以在启动时看到它。
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.13.3/log4j-slf4j-impl-2.13.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
此外,我在任何地方都看不到我的日志文件。 (但是在IntelliJ上,我确实在控制台上看到了日志)
这是我的log4j2.xml,我的pom.xml和一个虚拟启动应用程序。三者结合可以重现问题。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/>
</parent>
<groupId>question</groupId>
<artifactId>question</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.statemachine</groupId>
<artifactId>spring-statemachine-core</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-ui</artifactId>
<version>1.4.6</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.4.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">
<Properties>
<Property name="LOG_PATTERN">
%d{MM-dd HH:mm:ss} %5p - [%10.10t] %-30.30c{1.} : [%X{X-B3-TraceId},%X{X-B3-SpanId}] %m%n%ex
</Property>
</Properties>
<Appenders>
<Console name="ConsoleAppender" target="SYstem_OUT" follow="true">
<PatternLayout pattern="${LOG_PATTERN}"/>
</Console>
<RollingFile name="FileAppender" fileName="/logs/question.log"
filePattern="/logs/log4j2-demo-%d{yyyy-MM-dd}-%i.log">
<PatternLayout>
<Pattern>${LOG_PATTERN}</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<RollingFile name="ACCESS_LOG" fileName="/logs/access.log"
filePattern="/logs/access-%d{MM-dd-yyyy}-%i.log" append="true">
<PatternLayout>
<Pattern>${LOG_PATTERN}</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="question" level="INFO" additivity="false">
<AppenderRef ref="ConsoleAppender"/>
<AppenderRef ref="FileAppender"/>
</Logger>
<logger name="reactor.netty.http.server.AccessLog" level="INFO" additivity="false">
<AppenderRef ref="ACCESS_LOG"/>
</logger>
<Root level="info">
<AppenderRef ref="ConsoleAppender"/>
<AppenderRef ref="FileAppender"/>
</Root>
</Loggers>
</Configuration>
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@RestController
@SpringBootApplication
public class QuestionApplication {
private static final Logger LOGGER = LogManager.getLogger(QuestionApplication.class.getName());
public static void main(String[] args) {
SpringApplication.run(QuestionApplication.class);
}
@GetMapping(path = "/question")
public ResponseEntity<Mono<String>> question() {
LOGGER.info("I am not in any log file :'( please help");
return ResponseEntity.ok().body(Mono.just("question"));
}
}
然后我以以下方式启动我的应用程序:
java -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dreactor.netty.http.server.accessLogEnabled=true -jar myjar.jar
这是依赖关系树:
15:14:47 - [INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | +- org.springframework.boot:spring-boot:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
15:14:47 - [INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
15:14:47 - [INFO] | | | \- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile
15:14:47 - [INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
15:14:47 - [INFO] | | \- org.yaml:snakeyaml:jar:1.26:compile
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.2:compile
15:14:47 - [INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.2:compile
15:14:47 - [INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.2:compile
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | \- io.projectreactor.netty:reactor-netty:jar:0.9.12.RELEASE:compile
15:14:47 - [INFO] | | +- io.netty:netty-codec-http:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | | +- io.netty:netty-common:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | | +- io.netty:netty-buffer:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | | +- io.netty:netty-transport:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | | \- io.netty:netty-codec:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | +- io.netty:netty-codec-http2:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | +- io.netty:netty-handler:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | | \- io.netty:netty-resolver:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | +- io.netty:netty-handler-proxy:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | | \- io.netty:netty-codec-socks:jar:4.1.52.Final:compile
15:14:47 - [INFO] | | \- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.52.Final:compile
15:14:47 - [INFO] | | \- io.netty:netty-transport-native-unix-common:jar:4.1.52.Final:compile
15:14:47 - [INFO] | +- org.springframework:spring-web:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | | \- org.springframework:spring-beans:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework:spring-webflux:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | \- org.synchronoss.cloud:nio-multipart-parser:jar:1.1.0:compile
15:14:47 - [INFO] | +- org.slf4j:slf4j-api:jar:1.7.30:compile
15:14:47 - [INFO] | \- org.synchronoss.cloud:nio-stream-storage:jar:1.1.3:compile
15:14:47 - [INFO] +- org.springframework.boot:spring-boot-starter-data-cassandra-reactive:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework:spring-tx:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.data:spring-data-cassandra:jar:3.0.4.RELEASE:compile
15:14:47 - [INFO] | | +- org.springframework:spring-context:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | | +- org.springframework:spring-expression:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | | +- org.springframework.data:spring-data-commons:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | +- com.datastax.oss:java-driver-core:jar:4.6.1:compile
15:14:47 - [INFO] | | | +- com.datastax.oss:native-protocol:jar:1.4.10:compile
15:14:47 - [INFO] | | | +- com.datastax.oss:java-driver-shaded-guava:jar:25.1-jre:compile
15:14:47 - [INFO] | | | +- com.typesafe:config:jar:1.3.4:compile
15:14:47 - [INFO] | | | +- com.github.jnr:jnr-posix:jar:3.0.50:compile
15:14:47 - [INFO] | | | | +- com.github.jnr:jnr-ffi:jar:2.1.10:compile
15:14:47 - [INFO] | | | | | +- com.github.jnr:jffi:jar:1.2.19:compile
15:14:47 - [INFO] | | | | | +- com.github.jnr:jffi:jar:native:1.2.19:runtime
15:14:47 - [INFO] | | | | | +- org.ow2.asm:asm-commons:jar:7.1:compile
15:14:47 - [INFO] | | | | | +- org.ow2.asm:asm-analysis:jar:7.1:compile
15:14:47 - [INFO] | | | | | +- org.ow2.asm:asm-tree:jar:7.1:compile
15:14:47 - [INFO] | | | | | +- org.ow2.asm:asm-util:jar:7.1:compile
15:14:47 - [INFO] | | | | | +- com.github.jnr:jnr-a64asm:jar:1.0.0:compile
15:14:47 - [INFO] | | | | | \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile
15:14:47 - [INFO] | | | | \- com.github.jnr:jnr-constants:jar:0.9.12:compile
15:14:47 - [INFO] | | | +- org.javatuples:javatuples:jar:1.2:compile
15:14:47 - [INFO] | | | +- io.dropwizard.metrics:metrics-core:jar:4.1.12.1:compile
15:14:47 - [INFO] | | | +- com.esri.geometry:esri-geometry-api:jar:1.2.1:compile
15:14:47 - [INFO] | | | | +- org.json:json:jar:20090211:compile
15:14:47 - [INFO] | | | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
15:14:47 - [INFO] | | | +- org.apache.tinkerpop:gremlin-core:jar:3.4.5:compile
15:14:47 - [INFO] | | | | +- org.apache.tinkerpop:gremlin-shaded:jar:3.4.5:compile
15:14:47 - [INFO] | | | | +- commons-configuration:commons-configuration:jar:1.10:compile
15:14:47 - [INFO] | | | | | \- commons-lang:commons-lang:jar:2.6:compile
15:14:47 - [INFO] | | | | +- commons-collections:commons-collections:jar:3.2.2:compile
15:14:47 - [INFO] | | | | +- com.carrotsearch:hppc:jar:0.7.1:compile
15:14:47 - [INFO] | | | | +- com.jcabi:jcabi-manifests:jar:1.1:compile
15:14:47 - [INFO] | | | | | \- com.jcabi:jcabi-log:jar:0.14:compile
15:14:47 - [INFO] | | | | +- com.squareup:javapoet:jar:1.8.0:compile
15:14:47 - [INFO] | | | | \- net.objecthunter:exp4j:jar:0.4.8:compile
15:14:47 - [INFO] | | | +- org.apache.tinkerpop:tinkergraph-gremlin:jar:3.4.5:compile
15:14:47 - [INFO] | | | +- org.apache.tinkerpop:gremlin-driver:jar:3.4.5:compile
15:14:47 - [INFO] | | | | +- org.codehaus.groovy:groovy:jar:indy:2.5.7:compile
15:14:47 - [INFO] | | | | \- org.codehaus.groovy:groovy-json:jar:indy:2.5.7:compile
15:14:47 - [INFO] | | | +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
15:14:47 - [INFO] | | | \- com.github.spotbugs:spotbugs-annotations:jar:3.1.12:compile
15:14:47 - [INFO] | | | \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
15:14:47 - [INFO] | | \- com.datastax.oss:java-driver-query-builder:jar:4.6.1:compile
15:14:47 - [INFO] | \- io.projectreactor:reactor-core:jar:3.3.10.RELEASE:compile
15:14:47 - [INFO] | \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
15:14:47 - [INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework:spring-aop:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.security:spring-security-config:jar:5.3.4.RELEASE:compile
15:14:47 - [INFO] | | \- org.springframework.security:spring-security-core:jar:5.3.4.RELEASE:compile
15:14:47 - [INFO] | \- org.springframework.security:spring-security-web:jar:5.3.4.RELEASE:compile
15:14:47 - [INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.13.3:compile
15:14:47 - [INFO] | | \- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
15:14:47 - [INFO] | +- org.apache.logging.log4j:log4j-core:jar:2.13.3:compile
15:14:47 - [INFO] | +- org.apache.logging.log4j:log4j-jul:jar:2.13.3:compile
15:14:47 - [INFO] | \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
15:14:47 - [INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | \- org.springframework.boot:spring-boot-actuator:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | \- io.micrometer:micrometer-core:jar:1.5.5:compile
15:14:47 - [INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
15:14:47 - [INFO] | \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
15:14:47 - [INFO] +- org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j:jar:1.0.4.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.cloud:spring-cloud-starter:jar:2.2.5.RELEASE:compile
15:14:47 - [INFO] | | \- org.springframework.security:spring-security-rsa:jar:1.0.9.RELEASE:compile
15:14:47 - [INFO] | | \- org.bouncycastle:bcpkix-jdk15on:jar:1.64:compile
15:14:47 - [INFO] | | \- org.bouncycastle:bcprov-jdk15on:jar:1.64:compile
15:14:47 - [INFO] | +- org.springframework.cloud:spring-cloud-circuitbreaker-resilience4j:jar:1.0.4.RELEASE:compile
15:14:47 - [INFO] | +- io.github.resilience4j:resilience4j-circuitbreaker:jar:1.3.1:compile
15:14:47 - [INFO] | | +- io.vavr:vavr:jar:0.10.2:compile
15:14:47 - [INFO] | | | \- io.vavr:vavr-match:jar:0.10.2:compile
15:14:47 - [INFO] | | \- io.github.resilience4j:resilience4j-core:jar:1.3.1:compile
15:14:47 - [INFO] | +- io.github.resilience4j:resilience4j-timelimiter:jar:1.3.1:compile
15:14:47 - [INFO] | \- io.github.resilience4j:resilience4j-reactor:jar:1.3.1:compile
15:14:47 - [INFO] +- org.springframework.cloud:spring-cloud-starter-sleuth:jar:2.2.5.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.6:compile
15:14:47 - [INFO] | \- org.springframework.cloud:spring-cloud-sleuth-core:jar:2.2.5.RELEASE:compile
15:14:47 - [INFO] | +- org.aspectj:aspectjrt:jar:1.9.6:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-context-slf4j:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-messaging:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-rpc:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-spring-web:jar:5.12.3:compile
15:14:47 - [INFO] | | \- io.zipkin.brave:brave-instrumentation-http:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-spring-rabbit:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-kafka-clients:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-kafka-streams:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-httpclient:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-httpasyncclient:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-spring-webmvc:jar:5.12.3:compile
15:14:47 - [INFO] | | \- io.zipkin.brave:brave-instrumentation-servlet:jar:5.12.3:compile
15:14:47 - [INFO] | +- io.zipkin.brave:brave-instrumentation-jms:jar:5.12.3:compile
15:14:47 - [INFO] | \- io.zipkin.reporter2:zipkin-reporter-metrics-micrometer:jar:2.15.0:compile
15:14:47 - [INFO] +- org.springframework.cloud:spring-cloud-sleuth-zipkin:jar:2.2.5.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.cloud:spring-cloud-commons:jar:2.2.5.RELEASE:compile
15:14:47 - [INFO] | | \- org.springframework.security:spring-security-crypto:jar:5.3.4.RELEASE:compile
15:14:47 - [INFO] | +- io.zipkin.zipkin2:zipkin:jar:2.21.1:compile
15:14:47 - [INFO] | +- io.zipkin.reporter2:zipkin-reporter:jar:2.15.0:compile
15:14:47 - [INFO] | +- io.zipkin.reporter2:zipkin-reporter-brave:jar:2.15.0:compile
15:14:47 - [INFO] | +- io.zipkin.reporter2:zipkin-sender-kafka:jar:2.15.0:compile
15:14:47 - [INFO] | +- io.zipkin.reporter2:zipkin-sender-activemq-client:jar:2.15.0:compile
15:14:47 - [INFO] | \- io.zipkin.reporter2:zipkin-sender-amqp-client:jar:2.15.0:compile
15:14:47 - [INFO] +- org.springframework.cloud:spring-cloud-config-client:jar:2.2.5.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.3.4.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework.cloud:spring-cloud-context:jar:2.2.5.RELEASE:compile
15:14:47 - [INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.2:compile
15:14:47 - [INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.2:compile
15:14:47 - [INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.11.2:compile
15:14:47 - [INFO] | \- org.apache.httpcomponents:httpclient:jar:4.5.12:compile
15:14:47 - [INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
15:14:47 - [INFO] | \- commons-codec:commons-codec:jar:1.14:compile
15:14:47 - [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.3.4.RELEASE:test
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-test:jar:2.3.4.RELEASE:test
15:14:47 - [INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.3.4.RELEASE:test
15:14:47 - [INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
15:14:47 - [INFO] | | \- net.minidev:json-smart:jar:2.3:test
15:14:47 - [INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
15:14:47 - [INFO] | | \- org.ow2.asm:asm:jar:5.0.4:compile
15:14:47 - [INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
15:14:47 - [INFO] | | \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
15:14:47 - [INFO] | +- org.assertj:assertj-core:jar:3.16.1:test
15:14:47 - [INFO] | +- org.hamcrest:hamcrest:jar:2.2:test
15:14:47 - [INFO] | +- org.junit.vintage:junit-vintage-engine:jar:5.6.2:test
15:14:47 - [INFO] | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test
15:14:47 - [INFO] | | +- org.junit.platform:junit-platform-engine:jar:1.6.2:test
15:14:47 - [INFO] | | \- junit:junit:jar:4.13:test
15:14:47 - [INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.3.3:test
15:14:47 - [INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
15:14:47 - [INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
15:14:47 - [INFO] | +- org.springframework:spring-core:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | | \- org.springframework:spring-jcl:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] | +- org.springframework:spring-test:jar:5.2.9.RELEASE:test
15:14:47 - [INFO] | \- org.xmlunit:xmlunit-core:jar:2.7.0:test
15:14:47 - [INFO] +- org.junit.jupiter:junit-jupiter:jar:5.6.2:test
15:14:47 - [INFO] | +- org.junit.jupiter:junit-jupiter-api:jar:5.6.2:test
15:14:47 - [INFO] | | +- org.opentest4j:opentest4j:jar:1.2.0:test
15:14:47 - [INFO] | | \- org.junit.platform:junit-platform-commons:jar:1.6.2:test
15:14:47 - [INFO] | +- org.junit.jupiter:junit-jupiter-params:jar:5.6.2:test
15:14:47 - [INFO] | \- org.junit.jupiter:junit-jupiter-engine:jar:5.6.2:test
15:14:47 - [INFO] +- org.mockito:mockito-core:jar:3.3.3:test
15:14:47 - [INFO] | +- net.bytebuddy:byte-buddy:jar:1.10.14:test
15:14:47 - [INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.10.14:test
15:14:47 - [INFO] | \- org.objenesis:objenesis:jar:2.6:test
15:14:47 - [INFO] +- org.springframework.statemachine:spring-statemachine-core:jar:2.2.0.RELEASE:compile
15:14:47 - [INFO] | \- org.springframework:spring-messaging:jar:5.2.9.RELEASE:compile
15:14:47 - [INFO] +- de.codecentric:spring-boot-admin-starter-client:jar:2.3.0:compile
15:14:47 - [INFO] | \- de.codecentric:spring-boot-admin-client:jar:2.3.0:compile
15:14:47 - [INFO] +- org.springdoc:springdoc-openapi-webflux-ui:jar:1.4.6:compile
15:14:47 - [INFO] | +- org.springdoc:springdoc-openapi-webflux-core:jar:1.4.6:compile
15:14:47 - [INFO] | | \- org.springdoc:springdoc-openapi-common:jar:1.4.6:compile
15:14:47 - [INFO] | | +- io.swagger.core.v3:swagger-models:jar:2.1.4:compile
15:14:47 - [INFO] | | +- io.swagger.core.v3:swagger-annotations:jar:2.1.4:compile
15:14:47 - [INFO] | | +- io.swagger.core.v3:swagger-integration:jar:2.1.4:compile
15:14:47 - [INFO] | | | \- io.swagger.core.v3:swagger-core:jar:2.1.4:compile
15:14:47 - [INFO] | | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.11.2:compile
15:14:47 - [INFO] | | | \- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
15:14:47 - [INFO] | | +- io.github.classgraph:classgraph:jar:4.8.69:compile
15:14:47 - [INFO] | | \- org.apache.commons:commons-lang3:jar:3.10:compile
15:14:47 - [INFO] | +- org.webjars:swagger-ui:jar:3.32.5:compile
15:14:47 - [INFO] | \- org.webjars:webjars-locator-core:jar:0.45:compile
15:14:47 - [INFO] \- com.github.ulisesbocchio:jasypt-spring-boot-starter:jar:3.0.3:compile
15:14:47 - [INFO] \- com.github.ulisesbocchio:jasypt-spring-boot:jar:3.0.3:compile
15:14:47 - [INFO] \- org.jasypt:jasypt:jar:1.9.3:compile
我该怎么做才能使我的应用程序为log4j2? 有什么办法查看实际的日志文件?要使SLF4J消息消失? 是否有可能解决此问题而不必在pom的所有地方添加排除项? 谢谢您的帮助。
解决方法
只需从 maven spring-boot-starter-logging
中的 spring-boot-starter-webflux
依赖项中排除 pom.xml
并添加 spring-boot-starter-log4j2
。
类似于此处所述:https://www.baeldung.com/spring-boot-logging#log4j2-configuration-logging
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。