1、log4j2在pom.xml中引入总是报LogManager.getLogger错误
这个主要是因为重复引用了log4j2的dependency文件
2、运行后总是报 Logback configuration error detected错误,这是因为pom文件配置的有问题,jar包存在冲突
解决方法是:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
然后重新加下最新的dependency依赖
<dependency>标签:logging,boot,学习心得,apache,org,log4j2,log4j From: https://www.cnblogs.com/gigi2653/p/16982402.html
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.2</version>
</dependency>