记一次惨痛的教训- log4j2 实际使用详解-xml配置
刚上手log4j2 ,就想着跑一个小的demo,但是出现了问题。配置的一步中有要进行xml文件的创建,我是这么创建的:设置好名称后,然后选择xml:
出来的结果是线下图的那个log4j2文件,注释注意,是那个不带xml后缀的那个。然后我就傻乎乎的跑测试用例,就结果就是找不到那个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.****.net/Hi_Boy_/article/details/80491358
以后一定老老实实的创建文件,不这样创建了。