log4j2.7整合到web3.0 (spring4.3.3)

来源:互联网 发布:阿里云的作用 编辑:程序博客网 时间:2024/06/06 05:32
今天再整合框架  spring4.3.3 + springMVC4.3.3+myBatis3.4.0 + log4j2.7 时,遇到了整合log4j2.7报错的问题,在web.xml中配置了 org.apache.logging.log4j.web.Log4jServletContextListener log4jServletFilter org.apache.logging.log4j.web.Log4jServletFilter log4jServletFilter /* REQUEST FORWARD INCLUDE ERROR ASYNC 发现报错 NoClassDeffoundError,最后在官网中发现:Log4j 2 "just works" in Servlet 3.0 and newer web applications. It is capable of automatically starting when the application deploys and shutting down when the application undeploys. Thanks to the ServletContainerInitializer API added to Servlet 3.0, the relevant Filter and ServletContextListener classes can be registered dynamically on web application startup. 在web3.0中log4j2.7是自动启停的,不需要在web.xml中配置只需要将log4j2.xml放在src目录下即可
0 0