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. 解决方案

  后来参照这位仁兄的文章就解决了,不明觉厉。    

  log4j2.yaml找不到配置文件问题

  添加了如下依赖解决的问题:

    <!-- 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>

  

最新文章

  1. PHP扩展-如何使用文件config.m4
  2. C++STL - 模板的其他特性
  3. Python 3 and MySQL
  4. 使用Jquery+EasyUI 进行框架项目开发案例讲解之三---角色管理源码分享
  5. POJ3164 Command Network(最小树形图)
  6. Servlet中乱码问题
  7. Android Animation学习(一) Property Animation介绍
  8. git学习笔记之一
  9. phantomjs-prebuilt@2.1.14 install: `node install.js`
  10. [css 实践篇] CSS box-orient
  11. 进程通信-SendMessage使用方法
  12. DaemonSet 典型应用场景 - 每天5分钟玩转 Docker 容器技术(129)
  13. Centos常用命令之:ls和cd
  14. Visual Studio 2019 正式版 更新内容
  15. AngularJS 1.x系列:AngularJS服务-Service、Factory、Provider、Value及Constant(5)
  16. 【转载】curl 模拟 GET\POST 请求,curl查看响应头 以及 curl post 上传文件
  17. 【转】AJAX请求和普通HTTP请求区别
  18. WPF 对控件进行截图且不丢失范围(转载)
  19. P3371 【模板】单源最短路径(弱化版)(Dijkstra算法)
  20. Configuration in ASP.NET Core(未完,待续)

热门文章

  1. 【原创】大叔经验分享(83)impala执行多个select distinct
  2. C++性能榨汁机之虚函数的开销
  3. JPA的API介绍、工具类抽取
  4. Impala 中invalidate metadata和refresh
  5. 运行tomcat7w.exe提示指定的服务未安装 解决办法
  6. Go语言根据数据表自动生成model以及controller代码
  7. linux程序对比
  8. web开发:形变、表格及多行文本操作
  9. 屏蔽恶意IP
  10. zabbix上添加交换机监控记事