gpt4 book ai didi

java - 来自 log4j2 的奇怪日志

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:21:02 27 4
gpt4 key购买 nike

我在 Tomcat 8 中运行一个应用程序,它使用 log4j2。一切正常,但每当我尝试记录某些内容时,Tomcat 的 stderr 中会出现以下消息:

ERROR Unable to create Lookup for web java.lang.ClassCastException: class org.apache.logging.log4j.web.WebLookup
at java.lang.Class.asSubclass(Class.java:3396)
at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:64)
at org.apache.logging.log4j.core.config.PropertiesPlugin.configureSubstitutor(PropertiesPlugin.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:339)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
....

这是怎么回事?

正如我所说,一切正常,但我不希望看到此消息,因为它看起来好像出了点问题。

最佳答案

您可能缺少 log4j-web 依赖项

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>2.16.0</version>
</dependency>

关于java - 来自 log4j2 的奇怪日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29121426/

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