VerySource

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1209|回复: 1

关于 Log4jConfigListener 的配置

[复制链接]

1

主题

2

帖子

3.00

积分

新手上路

Rank: 1

积分
3.00
发表于 2020-3-15 18:30:01 | 显示全部楼层 |阅读模式
急求 “动态的改变Log4jConfigListener 记录级别和策略,不需要重启Web应用”的方法。网络上查到的不够详细,望高人指点!!!!!
回复

使用道具 举报

0

主题

1

帖子

2.00

积分

新手上路

Rank: 1

积分
2.00
发表于 2020-9-5 07:45:01 | 显示全部楼层
<!-- Log4J配置begin -->
        <!--
                如果不定义webAppRootKey参数,那么webAppRootKey就是缺省的"webapp.root"。但最好设置,以免项目之间的名称冲突。
                定义以后,在Web Container启动时将把ROOT的绝对路径写到系统变量里。
                然后log4j的配置文件里就可以用${webName.root }来表示Web目录的绝对路径,把log文件存放于webapp中。
                此参数用于后面的“Log4jConfigListener”
        -->
        <context-param>
                <param-name>webAppRootKey</param-name>
                <param-value>xx.root</param-value>
        </context-param>
        <!--
                Spring ApplicationContext配置文件的路径。可使用通配符,多个路径用逗号分隔。
                此参数用于后面的“Spring-Context loader”
        -->
        <!--
                context-param> <param-name>a</param-name> <param-value>
                applicationContext.xml </param-value> </context-param
        -->
        <!--由Sprng载入的Log4j配置文件位置-->
        <!--
                context-param> <param-name>log4jConfigLocation</param-name>
                <param-value>log4j.properties</param-value> </context-param
        -->
        <!--Spring默认刷新Log4j配置文件的间隔,单位为millisecond-->
        <context-param>
                <param-name>log4jRefreshInterval</param-name>
                <param-value>60000</param-value>
        </context-param>
        <!--Spring log4j Config loader-->
        <listener>
                <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
        </listener>
        <!-- Log4J配置end -->
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

快速回复 返回顶部 返回列表