从开始设置风暴拓扑的日志级别 [英] Set Log Level of Storm Topology from Start

查看:33
本文介绍了从开始设置风暴拓扑的日志级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在初始化期间,我的 Storm 拓扑中出现了一个错误.我想从拓扑启动时将日志级别设置为DEBUG.

I have a bug that occurs in my Storm topology during initialization. I would like to set the log level to DEBUG from when the topology is started.

我意识到有一种机制可以使用 Storm UI 或 CLI 为正在运行的拓扑动态设置日志级别,但我无法在初始化期间拓扑中出现错误之前动态更改此设置.

I realize there is a mechanism to dynamically set the log level for a running topology using either the Storm UI or CLI, but I am not able to dynamically change this setting before the bug occurs in my topology during initialization.

如何将日志级别静态设置为 DEBUG,以便在拓扑初始化时查看更详细的日志?

How can I statically set the log level to DEBUG so that I can see more detailed logs when my topology is initialized?

推荐答案

以下仅适用于 Storm 2.0.0 及更高版本.

The following only applies to Storm 2.0.0 and later.

您可以在拓扑 jar 中包含一个 log4j2 配置文件.然后,您需要在拓扑配置中设置 topology.logging.config 属性.

You can include a log4j2 config file in your topology jar. You then need to set the topology.logging.config property in your topology configuration.

为方便起见,我将在此处包含文档:

I'll include the documentation here for convenience:

用户可用于配置 Log4j2 的日志文件.可以是 jar 中的资源(用 classpath:/path/to/resource 指定)或文件.除了常规的工作人员 log4j2 配置之外,还应用此配置.根据此处的规则合并配置:https://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration

Log file the user can use to configure Log4j2. Can be a resource in the jar (specified with classpath:/path/to/resource) or a file. This configuration is applied in addition to the regular worker log4j2 configuration. The configs are merged according to the rules here: https://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration

参见 https://github.com/apache/storm/blob/885ca981fc52bda6552be854c7e4af9c7a451cd2/storm-client/src/jvm/org/apache/storm/Config.java#L735

常规工作者 log4j2 配置"是 Storm 部署中的 log4j2/worker.xml 文件,假设为默认设置.

The "regular worker log4j2 configuration" is the log4j2/worker.xml file in your Storm deployment, assuming default settings.

这篇关于从开始设置风暴拓扑的日志级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆