【发布时间】:2015-11-11 05:07:30
【问题描述】:
是否可以为 log4j 1.x 的 log4j.properties 文件提供自定义位置? 我不想将该文件包含在项目的资源文件夹中。
【问题讨论】:
标签: spring logging configuration configuration-files
是否可以为 log4j 1.x 的 log4j.properties 文件提供自定义位置? 我不想将该文件包含在项目的资源文件夹中。
【问题讨论】:
标签: spring logging configuration configuration-files
使用上下文参数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>
用于 Web 环境中自定义 log4j 初始化的引导侦听器。代表
Log4jWebConfigurer...
log4j 配置文件的位置;要么是“类路径:”位置 (例如“classpath:myLog4j.properties”),绝对文件 URL(例如 "file:C:/log4j.properties),或相对于网络的普通路径 应用程序根目录(例如“/WEB-INF/log4j.properties”)。如果不 指定,默认 log4j 初始化将应用(“log4j.properties” 或类路径中的“log4j.xml”;请参阅 log4j 文档 细节)。 “log4jRefreshInterval”:
【讨论】: