myeclipse中的项目使用log4j问题
myeclipse中的项目实际地址是D:\Myeclipse10\***\WebRoot\,发布到tomcat的地址是D:\apache-tomcat-6.0.41\we...
myeclipse中的项目实际地址是D:\Myeclipse10\***\WebRoot\,发布到tomcat的地址是D:\apache-tomcat-6.0.41\webapps\***\,这样在使用log4j生成日志文件的时候报错:严重: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListenerjava.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [D:\Myeclipse10\***\WebRoot\] instead of [D:\apache-tomcat-6.0.41\webapps\***\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
这是web.xml
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/classes/log4j.properties</param-value> </context-param><!-- <context-param> --><!-- <param-name>webAppRootKey</param-name> --><!-- <param-value>wxyms.root</param-value>log4j的配置文件里可以用${wxyms.root}来表示刚刚设进去的系统变量 --><!-- </context-param> --> <!-- Listener log4jConfigLocation --> <listener> <listener-class> org.springframework.web.util.Log4jConfigListener </listener-class> </listener>
这该怎么解决!!! 展开
这是web.xml
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/classes/log4j.properties</param-value> </context-param><!-- <context-param> --><!-- <param-name>webAppRootKey</param-name> --><!-- <param-value>wxyms.root</param-value>log4j的配置文件里可以用${wxyms.root}来表示刚刚设进去的系统变量 --><!-- </context-param> --> <!-- Listener log4jConfigLocation --> <listener> <listener-class> org.springframework.web.util.Log4jConfigListener </listener-class> </listener>
这该怎么解决!!! 展开
展开全部
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:config/log4j.properties</param-value>
</context-param>
把log4j.properties放到resources目录中的config(新建一个)目录下试试
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:config/log4j.properties</param-value>
</context-param>
把log4j.properties放到resources目录中的config(新建一个)目录下试试
追问
试过了,不行,是监听器报的吧
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询