ERROR StatusLogger Log4j2 could not find a logging implementation.(新手向保姆级)

用intellij IDEA启动Struts2的Tomcat项目,控制台报错:

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

解决方法:

1、下载log4j-core和log4j-api,我下载的都是2.9.1版本

https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core

https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api

2、直接把下载的jar拖到lib目录下

3、File--->Project Structure--->Libraries

ERROR StatusLogger Log4j2 could not find a logging implementation.(新手向保姆级)_第1张图片

完成之后,再启动Tomcat,你会发现依旧报错:

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

接着你需要添加log4j2.xml文件到classpath也就是resource,有些人就会说,我没有resource啊,那你就得手动添加一个:

File--->Project Structure--->Modules

ERROR StatusLogger Log4j2 could not find a logging implementation.(新手向保姆级)_第2张图片

这样你就拥有一个resource了,接着往你的resource下添加log4j2.xml:



            
                        
                                    
                        
                        
                                    
                        
            
 
            
                        
                                    
                        
                        
                                    
                        
            

再启动试试,就已经OK啦

你可能感兴趣的:(ERROR StatusLogger Log4j2 could not find a logging implementation.(新手向保姆级))