Maven默认将所有文件从
src/main/resources放入
/WEB-INF/classes/。使用log4j,可以在Web
App部署描述符(
web.xml)的帮助下指定配置文件的位置。只需添加log4j侦听器:
<listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class></listener>
和上下文参数:
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.xml</param-value></context-param>
classpath:等价于
/WEB-INF/classes,您可以指定任何路径,例如使用
${catalina.home}tomcat特定变量。与file://前缀一起使用



