如何停止的消息显示火花控制台上? [英] How to stop messages displaying on spark console?
问题描述
我使用spark0.9和Scala 2.10。
I am using spark0.9 and scala 2.10.
一切工作正常。我只是想停止正在对火星外壳到来的各种消息。
Everything is working fine. I just want to stop various messages that are coming on spark shell.
我试图用log4j.properties文件,以阻止这些消息。
I tried to use log4j.properties file in order to stop these message.
下面是文件的内容 -
Here are contents of file -
# Define the root logger with appender file
log4j.rootCategory=WARN, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n
# Settings to quiet third party logs that are too verbose
log4j.logger.org.eclipse.jetty=WARN
log4j.logger.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO
log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO
但还是消息被越来越控制台上显示出来。
But still messages are getting displayed on console.
下面是一些随机的消息 -
Here are some random messages -
15/01/05 15:11:45 INFO SparkEnv: Registering BlockManagerMaster
15/01/05 15:11:45 INFO DiskBlockManager: Created local directory at /tmp/spark-local-20150105151145-b1ba
15/01/05 15:11:45 INFO MemoryStore: MemoryStore started with capacity 0.0 B.
15/01/05 15:11:45 INFO ConnectionManager: Bound socket to port 44728 with id = ConnectionManagerId(192.168.100.85,44728)
15/01/05 15:11:45 INFO BlockManagerMaster: Trying to register BlockManager
15/01/05 15:11:45 INFO BlockManagerMasterActor$BlockManagerInfo: Registering block manager 192.168.100.85:44728 with 0.0 B RAM
15/01/05 15:11:45 INFO BlockManagerMaster: Registered BlockManager
15/01/05 15:11:45 INFO HttpServer: Starting HTTP Server
15/01/05 15:11:45 INFO HttpBroadcast: Broadcast server star
如何阻止这样的消息?
How do I stop such messages???
推荐答案
感谢@AkhlD和@Sachin贾纳尼的建议在 .conf文件
文件更改。
Thanks @AkhlD and @Sachin Janani for suggesting changes in .conf
file.
继code解决了我的问题:
Following code solved my issue:
1)新增进口org.apache.log4j {级别,记录器}
进口栏目
2)增加以下后 VAL SC =新SparkContext(CONF创作火花上下文对象,即后线)
:
val rootLogger = Logger.getRootLogger()
rootLogger.setLevel(Level.ERROR)
这篇关于如何停止的消息显示火花控制台上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!