[ https://issues.apache.org/jira/browse/SPARK-16416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15367442#comment-15367442 ]
Mikael Ståldal edited comment on SPARK-16416 at 7/8/16 9:26 AM: ---------------------------------------------------------------- Maybe just add a log statement in {{ShutdownHookManager}} before adding any hook to force the logger to be created: {code} logDebug("Adding shutdown hook") {code} can be added here: https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/util/ShutdownHookManager.scala#L56 was (Author: mikaelstaldal): Maybe just add a log statement in {{ShutdownHookManager}} before registering any hook to force the logger to be created: {code} logDebug("Registering shutdown hook") {code} can be added here: https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/util/ShutdownHookManager.scala#L56 > Logging in shutdown hook does not work properly with Log4j 2.x > -------------------------------------------------------------- > > Key: SPARK-16416 > URL: https://issues.apache.org/jira/browse/SPARK-16416 > Project: Spark > Issue Type: Bug > Components: Spark Core > Affects Versions: 1.6.2 > Reporter: Mikael Ståldal > Priority: Minor > > Spark registers some shutdown hooks, and they log messages during shutdown: > https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/util/ShutdownHookManager.scala#L58 > Since the {{Logging}} trait creates SLF4J loggers lazily: > https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/internal/Logging.scala#L47 > a SLF4J logger is created during the execution of the shutdown hook. > This does not work when Log4j 2.x is used as SLF4J implementation: > https://issues.apache.org/jira/browse/LOG4J2-1222 > Even though Log4j 2.6 handles this more gracefully than before, it still does > emit a warning and will not be able to process the log message properly. > Proposed solution: make sure to eagerly create the SLF4J logger to be used in > shutdown hooks when registering the hook. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org