Set Log Level of Storm Topology from Start

試著忘記壹切 提交于 2019-12-24 19:03:43

问题


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.

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.

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


回答1:


The following only applies to Storm 2.0.0 and later.

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:

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

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

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



来源:https://stackoverflow.com/questions/58415648/set-log-level-of-storm-topology-from-start

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!