gpt4 book ai didi

java - 我应该将 log4j2.xml 放在 WAR 文件中的什么位置?

转载 作者:行者123 更新时间:2023-11-30 06:40:23 24 4
gpt4 key购买 nike

我使用 Log4j 1.2.15 和 1.2.17 很长一段时间。但由于它的 DailyRollingFileAppender 选项有 bug,导致日志在 1.2 中有时不会滚动,所以我正在尝试迁移到 Log4j2。

由于我没有 Log4j2 的经验,所以事情进展不顺利。我将 log4j2.xml 放在 /WEB-INF 下,并将以下几行添加到 Eclipse 中的 web.xml 中。

    ...
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>/WEB-INF/log4j2.xml</param-value>
</context-param>
</web-app>

然后我将项目导出到 WAR 中,并将其部署到 Websphere 上。它向我显示一个错误。

[2017/6/8   14:00:15:702 CST] 000000c4 SystemErr     R ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging.

我做错了什么吗?

最佳答案

请检查这个问题here

如果您在项目中使用 Maven,请考虑 stivlo 在该问题中的答案,并将您的配置文件放在 src/main/resources 下。

关于java - 我应该将 log4j2.xml 放在 WAR 文件中的什么位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44451116/

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