Spring 配置了log4g遇到的问题

Spring 配置了log4g遇到的问题

无人问我粥可暖 发布于 2021-11-27 字数 333 浏览 796 回复 1

java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter: class path resource [/log4j.properties] cannot be resolved to absolute file path because it does not exist

at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:155)

请问出现这样的错误是什么原因呢?

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情痴 2021-11-29 1 楼
下面是web.xml中配置log4g
#efefef;"><000080;background-color:#efefef;font-weight:bold;">context-param> 
#efefef;"><000080;background-color:#efefef;font-weight:bold;">param-name>log4jConfigLocation#efefef;"></000080;background-color:#efefef;font-weight:bold;">param-name> 
<!--<param-value>/WEB-INF/classes/log4j.properties</param-value>-->  
#efefef;"><000080;background-color:#efefef;font-weight:bold;">param-value>classpath:/log4j.properties#efefef;"></000080;background-color:#efefef;font-weight:bold;">param-value> 
#efefef;"></000080;background-color:#efefef;font-weight:bold;">context-param> 
#efefef;"><000080;background-color:#efefef;font-weight:bold;">context-param> 
#efefef;"><000080;background-color:#efefef;font-weight:bold;">param-name>log4jRefreshInterval#efefef;"></000080;background-color:#efefef;font-weight:bold;">param-name> 
#efefef;"><000080;background-color:#efefef;font-weight:bold;">param-value>60000#efefef;"></000080;background-color:#efefef;font-weight:bold;">param-value> 
#efefef;"></000080;background-color:#efefef;font-weight:bold;">context-param> 
#efefef;"><000080;background-color:#efefef;font-weight:bold;">listener>
#efefef;"><000080;background-color:#efefef;font-weight:bold;">listener-class> org.springframework.web.util.Log4jConfigListener #efefef;"></000080;background-color:#efefef;font-weight:bold;">listener-class> 
#efefef;"></000080;background-color:#efefef;font-weight:bold;">listener>