刚上手log4j2 ,就想着跑一个小的demo,但是出现了问题。配置的一步中有要进行xml文件的创建,我是这么创建的:
记一次惨痛的教训- log4j2 实际使用详解-xml配置设置好名称后,然后选择xml:
记一次惨痛的教训- log4j2 实际使用详解-xml配置
出来的结果是线下图的那个log4j2文件,注释注意,是那个不带xml后缀的那个。然后我就傻乎乎的跑测试用例,就结果就是找不到那个xml位置。
记一次惨痛的教训- log4j2 实际使用详解-xml配置
报错:ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property ‘log4j2.debug’ to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2

**解决方法:加上一个xml后缀。这样才是正确的方法,这样程序才能找到,害得我断点看,一步一步源码才找到原因。哎~~~~

顺便附上详细的xml配置方法吧:https://blog.csdn.net/Hi_Boy_/article/details/80491358
以后一定老老实实的创建文件,不这样创建了。

相关文章:

  • 2021-11-23
  • 2022-01-21
  • 2022-01-21
  • 2018-02-11
  • 2022-12-23
  • 2022-01-25
  • 2021-05-23
  • 2021-05-13
猜你喜欢
  • 2021-12-17
  • 2021-06-02
  • 2022-12-23
  • 2021-11-12
  • 2021-10-22
  • 2021-11-11
相关资源
相似解决方案