Yes, Spark seems to have its own shutdown hook and it logs stuff from
within there.

If I put shutdownHook="disable" in my log4j2.xml, the problem goes away.
But then I guess that Log4j is never shut down properly?

On Wed, Jul 22, 2015 at 8:39 AM, Ralph Goers <ralph.go...@dslextreme.com>
wrote:

> The currentContext value indicates whether the LoggerContext stored in the
> ThreadLocal should be used. This is usually the wrong choice which is why
> the value is usually set to false.  Instead, the LoggerContext is located
> via the ClassLoaderContextSelector which finds the LoggerContext for the
> ClassLoader of the class that owns the Logger.
>
> It looks to me like something is trying to log after logging has already
> shut down.  This is causing it to retrieve the LoggerContext, which has
> already been stopped, and then it tries to restart it. Because the
> LoggerContext is normally stopped by the execution of the shutdown hook it
> is a very bad sign that the shutdown hook is trying to be reestablished.
> My guess is that Spark has its own shutdown hook and is trying to log from
> it after our shutdown hook has already run.
>
> When Matt wrote this code I believe he allowed for this situation but I’d
> really have to dig into the code more to figure out. However, I did find
> http://stackoverflow.com/questions/17400136/how-to-log-within-shutdown-hooks-with-log4j2
> <
> http://stackoverflow.com/questions/17400136/how-to-log-within-shutdown-hooks-with-log4j2>
> which says to implement your own ShutdownCallbackRegistry.
>
> It might be a good idea to add the variation of the Shutdown registry
> mentioned in the article so that it can be configured.
>
> Ralph
>
> > On Jul 21, 2015, at 8:57 PM, Remko Popma <remko.po...@gmail.com> wrote:
> >
> > Looks like the context returned by
> > AbstractLoggerAdapter.java:102
> > is the result of LogManager.getContext(someClass, false);
> >
> > The boolean "false" indicates that a different LoggerContext may be
> created (and started). I suspect this is what causes the problem.
> >
> > Ralph understands this part better than me. Ralph, should the slf4j
> Log4jLoggerFactory pass "false" here? The default for LogManager seems to
> be "true"...
> >
> > Remko
> >
> > Sent from my iPhone
> >
> >> On 2015/07/21, at 22:58, Mikael Ståldal <mikael.stal...@magine.com>
> wrote:
> >>
> >> AbstractLoggerAdapter.java:102
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>


-- 
[image: MagineTV]

 *Mikael Ståldal*
Senior backend developer

 *Magine TV*
 mikael.stal...@magine.com
 Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com

 Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.

Reply via email to