log4j+spring配置--webAppRootKey
问题描述:
在web.xml中配置
<context-param> <param-name>webAppRootKey</param-name> <param-value>myapp.root</param-value> </context-param> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/classes/log4j.properties</param-value> </context-param>
在log4j.properties中写到:
log4j.appender.logfile.File=${myapp.root}/WEB-INF/myapp.log
但是这样会生成两个文件:
/WEB-INF/myapp.log
<TOMCAT_HOME>/webapps/myapp/myapp.log 这个是我所期望的
解决:
实际上是被server和app加载了两次,不要把log4j.properties放在默认位置,classes顶层目录,
或者不需要指定
log4jConfigLocation
相关推荐
chw0 2020-11-04
大唐帝国前营 2020-08-18
sdaq 2020-07-26
MrLiar 2020-07-07
sdaq 2020-06-16
CXC0 2020-06-14
丨Fanny丨Cri 2020-06-13
CXC0 2020-06-08
dongxurr 2020-06-07
sdaq 2020-06-06
MrLiar 2020-06-04
丨Fanny丨Cri 2020-06-03
MrLiar 2020-05-25
丨Fanny丨Cri 2020-05-17
MrLiar 2020-05-14
MrLiar 2020-05-12
sdaq 2020-05-11