我从主节点(以编程方式运行)提供配置文件(通过 -Dlog4j.configurationFile)。主节点分发一个批处理作业(10个类似的任务)。该任务涉及使用以下 log4j 行的第三方代码:
final org.apache.logging.log4j.Logger lgr = LogManager.getLogger(Command.class).
主节点没有问题并且工作正常,但其他节点(通过 bin/ignite.bat 启动)显示以下内容:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
最佳答案
通过将以下内容添加到节点配置中,在使用 ignite.bat 启动的其他节点上设置 Log4j 记录器
<property name="gridLogger">
<bean class="org.apache.ignite.logger.log4j.Log4JLogger">
<constructor-arg type="java.lang.String" value="config/ignite-log4j.xml"/>
</bean>
</property>
还要确保“config/ignite-log4j.xml”位于您的 Apache 发行版中。最后不要忘记将“ignite-log4j”lib从“libs/Optional”文件夹移动到“libs”文件夹。
关于ignite - 来自 Ignite 节点中第三方代码的 Log4j : no configuration file found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37870443/