2016-02-04 61 views
6

我使用的Apache Spark的spark-shell與mesos和zookeeper,這似乎工作得很好,除了我從zookeeper得到更多的日誌記錄比我想,這是一個有點分散注意力:本地更改動物園管理員C客戶端的日誌級別

Welcome to 
     ____    __ 
    /__/__ ___ _____/ /__ 
    _\ \/ _ \/ _ `/ __/ '_/ 
    /___/ .__/\_,_/_/ /_/\_\ version 1.5.0 
     /_/ 

Using Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60) 
Type in expressions to have them evaluated. 
Type :help for more information. 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: Client environment:zookeeper.version=zookeeper C client 3.4.6 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: Client environment:host.name=myhost 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: Client environment:os.name=Linux 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: Client environment:os.arch=3.2.0-34-generic 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: Client environment:os.version=#53-Ubuntu SMP Thu Nov 15 10:48:16 UTC 2012 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: Client environment:user.name=myname 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: Initiating client connection, host=localhost:9999 sessionTimeout=10000 watcher=0xffffffffff sessionId=0 sessionPasswd=<null> context=0x777777777777 flags=0 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: initiated connection to server [127.0.0.1:9999] 
2015-03-26 20:08:22,115:15978(0x7f83a1fbc740):[email protected][email protected]: session establishment complete on server [127.0.0.1:9999], sessionId=0x11111111111111, negotiated timeout=10000 
Spark context available as sc. 
SQL context available as sqlContext. 

scala> 

我試圖改變$SPARK_CONF_DIR/log4j.properties

log4j.logger.org.apache.zookeeper=WARN 

,沒有工作,但我並不感到驚訝,因爲在mesos documentation mentions that the zookeeper logging goes directly to stderr

注意:第三方日誌消息(例如, ZooKeeper)只寫入stderr!

加入廣口瓶中,引發的是具有與外國功能接口調用zookeeper C api function to change the log level靜態塊好像它可能工作classpath中,但我不知道,我沒有與調用任何經驗來自JVM的C代碼。

回答

1

除,

log4j.logger.org.apache.zookeeper=WARN 

配置stderr日誌級別僅打印優先ERROR(及以上)日誌。

# Send WARN or higher to stderr 
log4j.appender.stderr = org.apache.log4j.ConsoleAppender 
log4j.appender.stderr.Threshold = ERROR 
log4j.appender.stderr.Target = System.err 

另外一個LevelRangeFilter也可以如圖here證明是有用的。

+0

不,這對動物園管理員的'ZOO_INFO'日誌沒有任何影響,這些日誌仍然在stderr上吐出來。 – rampion

1

在這個上找不到任何東西,但對於JNI(Java-to-C)可以提供this。看起來沒有zookeeper沒有mesos有網絡服務或shell(zookeeper有zkshell雖然,但在我們的情況下不可用),可以使用。