Amol M Kulkarni Amol M Kulkarni - 4 years ago 164
Java Question

How to disable/turn off the logging feature from Storm

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.

Below is the example of log:

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");
}
}


Output (correct) :
0 [main] FATAL TopologyMain - Here is some FATAL


But I require to change the logging configure of storm/zookeper,etc..

Could anyone please help on this?



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 :-(

Answer Source

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.

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download