Spring Boot ERROR StatusLogger No Log4j 2 configuration file found
2024-08-31 17:10:56
1. 问题描述
项目之前的 log4j2 配置没问题,把 pom 文件中的 spring-boot-starter-web 依赖删除后,然后启动项目就报错找不到 log4j2.yml 文件。
之前引用的 log4j2 依赖pom如下:
<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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency> <dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.9.7</version>
</dependency>
2. 解决方案
后来参照这位仁兄的文章就解决了,不明觉厉。
添加了如下依赖解决的问题:
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.0</version>
</dependency> <!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.25</version>
</dependency>
最新文章
- PHP扩展-如何使用文件config.m4
- C++STL - 模板的其他特性
- Python 3 and MySQL
- 使用Jquery+EasyUI 进行框架项目开发案例讲解之三---角色管理源码分享
- POJ3164 Command Network(最小树形图)
- Servlet中乱码问题
- Android Animation学习(一) Property Animation介绍
- git学习笔记之一
- phantomjs-prebuilt@2.1.14 install: `node install.js`
- [css 实践篇] CSS box-orient
- 进程通信-SendMessage使用方法
- DaemonSet 典型应用场景 - 每天5分钟玩转 Docker 容器技术(129)
- Centos常用命令之:ls和cd
- Visual Studio 2019 正式版 更新内容
- AngularJS 1.x系列:AngularJS服务-Service、Factory、Provider、Value及Constant(5)
- 【转载】curl 模拟 GET\POST 请求,curl查看响应头 以及 curl post 上传文件
- 【转】AJAX请求和普通HTTP请求区别
- WPF 对控件进行截图且不丢失范围(转载)
- P3371 【模板】单源最短路径(弱化版)(Dijkstra算法)
- Configuration in ASP.NET Core(未完,待续)