整合SSH后,项目本身没有报错,但一运行就提示tomcat打开失败并报错,在网上查了很多资料,终于找到解决方案:在项目右键Build Path打开后在如图的位置添加一个“log4j2.xml”的文件即可解决问题(log4j2.xml代码在文末)
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>