Scala sbt console(启动ammonite shell):如何禁用调试日志记录

我在sbt控制台中启动Ammonite
shell并尝试运行spark作业,我看到日志级别是Debug,它打印出所有调试级别记录器,这些记录器生成大量日志并永远完成工作.

14:36:14.331 [run-main-0] DEBUG org.apache.http.wire -  >> "Content-Type: application/octet-stream[\r][\n]"
14:36:14.331 [run-main-0] DEBUG org.apache.http.wire -  >> "Connection: Keep-Alive[\r][\n]"
14:36:14.331 [run-main-0] DEBUG org.apache.http.wire -  >> "[\r][\n]"
14:36:14.331 [run-main-0] DEBUG org.apache.http.headers - >> GET /nlp/resources/DecisionSentence/parenUnigrams.txt HTTP/1.1
14:36:14.331 [run-main-0] DEBUG org.apache.http.headers - >> Host: ravellaw.s3-us-west-2.amazonaws.com
14:36:14.331 [run-main-0] DEBUG org.apache.http.headers - >> X-Amz-Date: 20160209T223614Z

以下是我尝试禁用调试级别日志记录的设置,但我仍然看到调试级别记录器

在build.sbt中添加:

showSuccess := false
logLevel in console := Level.Warn
logLevel in run := Level.Warn

试图使用warn调用sbt控制台:

sbt – 警告控制台

在sbt控制台中尝试以下设置:

System.setProperty("log4j.logger.org.apache.http.wire", "WARN")
System.setProperty("log4j.logger.org.apache.http.headers", "WARN")
System.setProperty("log4j.logger.org.apache.http.content", "WARN")

编辑/spark/conf/log4j.properties并更改了行格式

log4j.rootCategory=INFO, console

log4j.rootCategory=WARN, console

不幸的是,在所有这些更改之后,我仍然看到调试级别

最佳答案 解决了我在repl中运行这些问题的问题

import ch.qos.logback.classic.Logger
import org.slf4j.LoggerFactory
import ch.qos.logback.classic.Level

val root = LoggerFactory.getLogger("org.apache.http.wire").asInstanceOf[Logger]

root.setLevel(Level.WARN)
点赞