- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据要求和出于安全目的,我正在更新 Struts 项目。之前的Struts版本是2.3.24,现在更新到2.5.12。我已经下载了所有必需的 Struts jar 文件并应用于项目,但出现以下错误
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.
但我没有在我的项目中使用任何记录器。我已经添加了所有的依赖 jar 文件,我没有使用 Maven,而是在 lib 文件夹中添加了相关的库。请提出任何建议。
最佳答案
Struts 框架正在使用日志框架 log4j 第二版。
Struts 2.3 to 2.5 migration
Please be aware that the framework is using Log4j2 now as a main logging layer, the existing old logging layer is deprecated and will be removed soon. Log4j2 supports many different logging implementations, please check documentations for more details.
引导日志框架需要文件 log4j2.xml
。但是类路径中缺少它。 Struts 框架也缺少它。
您应该找到一些 log4j2.xml
,即来自 struts-showcase 应用程序或阅读本教程中的第 4 步 How To Create A Struts 2 Web Application
Step 4 - Add Logging
To see what’s happening under the hood, the example application for this tutorial uses log4j2. You’ll need to add a dependency node for log4j2 to the pom:
pom.xml log4j dependency node
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>Using both log4j-core and log4j-api allows to use the latest version of Log4j2 without a clash with version provided by the framework. Setup a log4j2.xml configuration in the src/main/resources folder which contains the following
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="com.opensymphony.xwork2" level="debug"/>
<Logger name="org.apache.struts2" level="debug"/>
<Root level="warn">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>Note the above log4j2 configuration specifies the console as the log target.
关于java - 错误 StatusLogger 找不到 log4j2 配置文件。在更新Struts 2.5.12版本时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45647599/
在使用 log4j 和 slf4j 的应用程序中,我尝试使用依赖于 log4j2 的 elasticsearch jar。 应用程序的日志依赖关系如下所示- org.slf4
我在我的应用程序中使用 Apache POI 5.2.2。 Apache POI 使用 log4j2 作为其用于调试的内部日志记录机制。因此 log4j-api-2.17.2.jar 是必需的依赖项。
当我在 intellij Idea 中运行 main 方法时,我的项目中有 log4j2,它正确地打印日志。 当我使用 maven-shade-plugin 包项目到 jar 文件,并将 jar 作为
我正在尝试实现 log4j 2 但它一直抛出以下错误。 > ERROR StatusLogger Log4j2 could not find a logging implementation. > P
使用 Intellij 在 IDE 中运行时出现以下错误 - ERROR StatusLogger No Log4j 2 configuration file found. Using default
我有一个使用 log4j1.2.17 的应用程序。现在我想将其更改为 log4j2。所以我更改了 pom.xml(我确信我已经删除了任何依赖项中的 log4j1),添加了 log4j2.xml。 lo
当运行 mvn verify 时,我收到以下消息: 我已经将 log4j2.xml 放在 src/test/resources 下(但不在 src/main/resources 下,因为我不希望它按照
这是我的配置文件: ./log %d{yyyy-MM-dd HH:mm:ss.SSS} [%p]\t%m%n
我正在使用 log4j2,jar 文件如下: log4j-api-2.14.0.jar log4j-core-2.14.0.jar log4j-slf4j-impl-2.14.0.jar 执行以下行:
这是我第一次遇到这个问题,我在 Linux 和 Mac 上使用本地 DynamoDB 并且大部分时间它都运行良好,现在我在另一台 Mac 机器上,它只是抛出一个错误。 我得到的错误信息是: ERROR
从 java 客户端,尝试通过使用 PreBuiltTransportClient 和以下代码来连接到 Elasticsearch , Settings settings = Settings.bui
我在\src\main\resources 中有以下 log4j2.xml (位于类路径中): . output.log [%-5leve
我正在使用 logback 来登录我的应用程序 ch.qos.logback logback-classic 1.2.3 在我的类里面我使用这个 Logger logger
我试图将 log4j2 添加到 spring boot 项目,但它给出了以下错误。 错误 StatusLogger Log4j2 找不到日志记录实现。请将 log4j-core 添加到类路径中。使用
我是 Storm 的新手。我在本地机器上安装了 zookeeper、storm、java。 Zookeeper 工作正常。当我尝试使用命令storm nimbus 运行nimbus 时,出现以下错误。
我正在尝试在 Ant build.xml 中使用 log4j2 来创建可执行的 .jar。该 jar 工作正常,但似乎 log4j2.xml 未被识别。我目前在 src 文件夹下有该文件。并在我的 b
根据要求和出于安全目的,我正在更新 Struts 项目。之前的Struts版本是2.3.24,现在更新到2.5.12。我已经下载了所有必需的 Struts jar 文件并应用于项目,但出现以下错误 E
刚开始接触 Graylog2,想通过 GELF 输入记录一些 Java 应用程序。因此我使用了库 log4j2 并添加了 graylog2-gelfclient。满足所有依赖项并且程序正在运行。但是我
我将 elasticsearch java 客户端从 2.3 升级到 5.1。 并且此错误日志继续出现。 ERROR StatusLogger Log4j2 could not find a logg
我在片段项目的 pom.xml 中有 log4j-api v2.0.2 和 log4j-core v2.0.2,并尝试构建一个符合 OSGI 的项目。我收到以下消息 "ERROR StatusLog
我是一名优秀的程序员,十分优秀!