vanzin commented on a change in pull request #23675: [SPARK-26753][CORE] Fix 
for ensuring custom log levels work for spark-shell
URL: https://github.com/apache/spark/pull/23675#discussion_r251648478
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/util/Utils.scala
 ##########
 @@ -2285,7 +2287,15 @@ private[spark] object Utils extends Logging {
     val rootLogger = org.apache.log4j.Logger.getRootLogger()
     rootLogger.setLevel(l)
     rootLogger.getAllAppenders().asScala.foreach {
-      case ca: org.apache.log4j.ConsoleAppender => ca.setThreshold(l)
+      case ca: org.apache.log4j.ConsoleAppender =>
+        var f = ca.getFirstFilter()
+        while (f != null) {
+          f match {
+            case ssf: SparkShellLoggingFilter =>
 
 Review comment:
   This match is not exhaustive. It will throw an exception if there's another 
filter.
   
   It might be simpler to keep the current log level in the `Logging` object; 
that way the filter does not need to be mutable, and this code would just set 
that variable.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to