Spring 网络应用程序的自定义 log4j.properties 位置
Custom log4j.properties location for Spring web application
是否可以为 log4j 1.x 的 log4j.properties 文件提供自定义位置?
我不想将该文件包含在项目的资源文件夹中。
使用上下文参数 log4jConfigLocation
在 web.xml
中配置 org.springframework.web.util.Log4jConfigListener
。
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>file:C:/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
Bootstrap listener for custom log4j initialization in a web environment. Delegates to Log4jWebConfigurer
...
Location of the log4j config file; either a "classpath:" location
(e.g. "classpath:myLog4j.properties"), an absolute file URL (e.g.
"file:C:/log4j.properties), or a plain path relative to the web
application root directory (e.g. "/WEB-INF/log4j.properties"). If not
specified, default log4j initialization will apply ("log4j.properties"
or "log4j.xml" in the class path; see the log4j documentation for
details). "log4jRefreshInterval":
是否可以为 log4j 1.x 的 log4j.properties 文件提供自定义位置? 我不想将该文件包含在项目的资源文件夹中。
使用上下文参数 log4jConfigLocation
在 web.xml
中配置 org.springframework.web.util.Log4jConfigListener
。
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>file:C:/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
Bootstrap listener for custom log4j initialization in a web environment. Delegates to
Log4jWebConfigurer
...
Location of the log4j config file; either a "classpath:" location (e.g. "classpath:myLog4j.properties"), an absolute file URL (e.g. "file:C:/log4j.properties), or a plain path relative to the web application root directory (e.g. "/WEB-INF/log4j.properties"). If not specified, default log4j initialization will apply ("log4j.properties" or "log4j.xml" in the class path; see the log4j documentation for details). "log4jRefreshInterval":