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_r251649295
##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -2991,3 +3001,32 @@ private[spark] class CircularBuffer(sizeInBytes: Int =
10240) extends java.io.Ou
new String(nonCircularBuffer, StandardCharsets.UTF_8)
}
}
+
+private[spark] class SparkShellLoggingFilter(var thresholdLevel: Level)
extends Filter {
+
+ /**
+ * If log level of event is lower than thresholdLevel, then the decision is
made based on
+ * whether the log came from root or some custom configuration
+ * @param loggingEvent
+ * @return decision for accept/deny log event
+ */
+ def decide(loggingEvent: LoggingEvent): Int = {
+ val rootLevel = LogManager.getRootLogger().getLevel()
+ if (loggingEvent.getLevel().isGreaterOrEqual(thresholdLevel) ||
+ !loggingEvent.getLevel().eq(rootLevel)) {
+ return Filter.NEUTRAL
+ }
+ var logger = loggingEvent.getLogger()
+ while(logger.getParent() != null) {
Review comment:
Space after `while`.
----------------------------------------------------------------
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]