当我们从本地集群运行时,我想关闭默认提供的日志记录功能。目前它在控制台上记录了很多信息。
以下是日志示例:
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
在浏览了许多文档之后,我最终得到了下面的代码,我可以在课堂上关闭日志记录。
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 [main] FATAL TopologyMain - Here is some FATAL
但我需要更改storm/zookeper等的日志配置。
有人可以帮忙吗?
更新:以下是我尝试过的代码,但它不起作用。我尝试使用版本 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 :-(