问题描述
我想关闭从本地群集运行时默认提供的日志记录功能。
目前它在控制台上记录了很多信息。
I want to turn off the logging feature offered by default when we run from local cluster.Currently its logging so many information on the console.
下面是日志的例子:
261 [main] INFO backtype.storm.daemon.task - Shut down task Getting-Started-Toplogie-1-1376388324:2
2261 [main] INFO backtype.storm.daemon.task - Shutting down task Getting-Started-Toplogie-1-1376388324:1
2262 [Thread-24] INFO backtype.storm.util - Async loop interrupted!
2276 [main] INFO backtype.storm.daemon.task - Shut down task Getting-Started-Toplogie-1-1376388324:1
2278 [main] INFO backtype.storm.daemon.worker - Terminating zmq context
2279 [main] INFO backtype.storm.daemon.worker - Disconnecting from storm cluster state context
2279 [main] INFO backtype.storm.daemon.worker - Waiting for heartbeat thread to die
2279 [Thread-27] INFO backtype.storm.util - Async loop interrupted!
2308 [main] INFO backtype.storm.testing - Shutting down in process zookeeper
2309 [main] INFO backtype.storm.testing - Done shutting down in process zookeeper
2309 [main] INFO backtype.storm.testing - Deleting temporary path /tmp/255fe7c8-1407-4f43-8771-2217905232ab
经过许多文档之后,我最终得到了以下代码,我可以从类中关闭日志记录。
After going through many docs, I ended up with the below code, I am able to turn off the logging from within class.
static Logger logger = Logger.getLogger(TopologyMain.class);
public static void main(String[] args) throws InterruptedException, AlreadyAliveException, InvalidTopologyException {
logger.setLevel((Level) Level.FATAL);
logger.debug("Here is some DEBUG");
logger.info("Here is some INFO");
logger.warn("Here is some WARN");
logger.error("Here is some ERROR");
logger.fatal("Here is some FATAL");
}
}
输出(正确): 0 [主要]致命的TopologyMain - 这是一些致命的
但是我需要更改storm / zookeper的日志配置等。
But I require to change the logging configure of storm/zookeper,etc..
有人可以帮忙吗?
更新:以下是我尝试的代码,但它不起作用。我试过版本0.7.1,0.8.2& 0.9.0-wip *
Update: The following is the code I tried, but it does not work. I tried with version 0.7.1, 0.8.2 & 0.9.0-wip*
//Configuration
Config conf = new Config();
conf.put(Config.TOPOLOGY_DEBUG, false); //Tried this alone
conf.setDebug(false); //Tried this alone & tried both together as well.. No change :-(
推荐答案
风暴真的很健谈并讲述了很多信息,但如果你想让它沉默,你可以设置为false。
Storm is really chatty and tells a lot of information but if you want to silence it, you can set Config.TOPOLOGY_DEBUG to false.
当您将Config.TOPOLOGY_DEBUG设置为true时,您告诉Storm每次都记录一条消息时间从任何喷口或螺栓发出元组。
When you set Config.TOPOLOGY_DEBUG to true, you are telling Storm to log a message every time a tuple is emitted from any spout or bolt.
这篇关于如何从Storm中禁用/关闭日志记录功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!