ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the clas

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

ERROR Dispatcher Dispatcher initialization failed

 Unable to load configuration. - bean - jar:file:/Users/liuzhao/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2.0Demos/WEB-INF/lib/struts2-gxp-plugin-2.5.20.jar!/struts-plugin.xml:27:162

找不到log4j2的配置文件

解决办法:

在classpath下的目录添加一个log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>

<Configuration status="warn">  
            <Appenders>  
                        <Console name="Console" target="SYSTEM_OUT">  
                                    <PatternLayout pattern="[%-5p] %d %c - %m%n" />  
                        </Console>  
                        <File name="File" fileName="dist/my.log">  
                                    <PatternLayout pattern="%m%n" />  
                        </File>  
            </Appenders>  
  
            <Loggers>  
                        <Logger name="mh.sample2.Log4jTest2" level="INFO">  
                                    <AppenderRef ref="File" />  
                        </Logger>  
                        <Root level="INFO">  
                                    <AppenderRef ref="Console" />  
                        </Root>  
            </Loggers>  
</Configuration> 

猜你喜欢

转载自blog.csdn.net/weixin_40200876/article/details/88040751
今日推荐