gpt4 book ai didi

Spring 5 如何使用 Log4jConfigListener

转载 作者:行者123 更新时间:2023-12-01 01:43:30 32 4
gpt4 key购买 nike

以前我用spring 4.3.8版本,
我曾经在 web.xml 中使用 Log4j 配置,如下面的代码,

<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

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

我可以使用“log4j.xml”(默认名称)但我想使用自定义名称作为服务器,本地环境

我能怎么做?

最佳答案

从 Spring 4.2.1 开始, Log4jConfigListener 已被删除,以支持 Apache Log4j 2。
相关信息见Spring 4.2.1 deprecation list:

org.springframework.web.util.Log4jConfigListener

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


您可以使用 Environment Lookup 在 XML 文件中配置环境。

关于Spring 5 如何使用 Log4jConfigListener,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53868470/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com