Spring 5如何使用Log4jConfigListener [英] Spring 5 how to use Log4jConfigListener

查看:1388
本文介绍了Spring 5如何使用Log4jConfigListener的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去,我曾经使用过Spring 4.3.8版本, 我曾经在web.xml中使用Log4j进行配置,如以下代码所示,

In the past, i used to spring 4.3.8 version, i used to Log4j config in web.xml like below code,

<context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>classpath:/log4j-${spring.profiles.active}.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

当前,我尝试使用Spring 5.0.7版本,但无法使用Log4jConfigListener

Currently, i trying to use spring 5.0.7 version but, i can't use Log4jConfigListener

我意识到在Spring 5.x版本中不存在Log4jConfigListener

i realized Log4jConfigListener is not exist in spring 5.x version

我可以使用"log4j.xml"(默认名称),但是我想在服务器本地环境中使用自定义名称

I can use "log4j.xml"(default name) but i want to use custom name for sever,local environment

我该怎么办?

推荐答案

The Log4jConfigListener has been removed as of Spring 4.2.1, in favor of Apache Log4j 2.

请参阅相关信息春季4.2.1弃用列表:

org.springframework.web.util.Log4jConfigListener

org.springframework.web.util.Log4jConfigListener

从Spring 4.2.1开始,支持Apache Log4j 2(遵循Apache对log4j 1.x的EOL声明)

as of Spring 4.2.1, in favor of Apache Log4j 2 (following Apache's EOL declaration for log4j 1.x)

您可以使用环境查找.

这篇关于Spring 5如何使用Log4jConfigListener的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆