ERROR StatusLogger No log4j2 configuration file found. Using default configuration: xxxxx

由于spring boot项目中使用的是log4j.yml的形式打印的日志,但是配置了log4j2的依赖之后没有给我打印日志就爆出了一个错误,如下:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.

我对比了下我的依赖发现有一个模块能够打印日志,唯独这一个模块中出现了上面的错误,所

以我找了一下依赖发现log4j2使用yml的时候需要

com.fasterxml.jackson.dataformat:jackson-dataformat-yaml这个包做支撑,
在spring-boot-starter-web依赖中又恰巧有

com.fasterxml.jackson.dataformat的相关依赖所以我猜想加入

com.fasterxml.jackson.dataformat一些引用就可以了

* 解决办法: *

1).如果没有引入spring-boot-starter-web依赖:


1-1)使用log4j2.xml 替代 在项目的src/main/resources中加入log4j2.xml文件并修改application.yml中的logging.config: classpath:log4j2.xml



1-2)加入依赖 com.fasterxml.jackson.datatype:jackson-datatype-jdk8就可以接着使用log4j2.yml了

2).引入spring-boot-starter-web依赖:

引入org.springframework.boot:spring-boot-starter-web依赖就可以

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值