You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Mikael Ståldal (JIRA)" <ji...@apache.org> on 2016/07/08 09:26:10 UTC

[jira] [Commented] (SPARK-16416) Logging in shutdown hook does not work properly with Log4j 2.x

    [ https://issues.apache.org/jira/browse/SPARK-16416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15367442#comment-15367442 ] 

Mikael Ståldal commented on SPARK-16416:
----------------------------------------

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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org