Java – how to disable info logging in HBase client applications?
•
Java
I'm writing a Java console application to access HBase, and I can't figure out how to get rid of all annoying info messages:
13/05/24 11:01:12 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.5-1392090,built on 09/30/2012 17:52 GMT 13/05/24 11:01:12 INFO zookeeper.ZooKeeper: Client environment:host.name=10.1.0.110 13/05/24 11:01:12 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0_15 13/05/24 11:01:12 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation 13/05/24 11:01:12 INFO zookeeper.ZooKeeper: Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/jre
Wait
I've tried several different things from the client code itself, but none of the obvious methods worked for me
This is an example that doesn't work:
Logger log = Logger.getLogger("log4j.logger.org.apache.zookeeper"); log.setLevel(Level.WARN);
Solution
You can delete packages one by one, for example:
Logger.getLogger("org.apache.zookeeper").setLevel(Level.WARN); Logger.getLogger("org.apache.hadoop.hbase.zookeeper").setLevel(Level.WARN); Logger.getLogger("org.apache.hadoop.hbase.client").setLevel(Level.WARN);
Or simply manipulate the rootlogger:
Logger.getRootLogger().setLevel(Level.WARN);
Note: at HBase 0.94 Test on 5
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码