Akka: Stop logback from shutdown hook

Created on 20 Nov 2019  路  3Comments  路  Source: akka/akka

Might be important for flushing/closing async appenders.

If shutdown is added with logback.xml configuration I suspect that it may run before ActorSystem shutdown since order of jvm hooks are undefined.

Since there might be several ActorSystems in same JVM we can't just do it after AS termination.

1 - triaged

Most helpful comment

Attn: @marcospereira @ignasi35 this might impact Play, too.

Play disables Akka's shutdown hook, and it stops the logging framework from a CoordinatedShutdown.PhaseBeforeActorSystemTerminate task. That might be too early, if the ActorSystem logs anything while terminating.

All 3 comments

Attn: @marcospereira @ignasi35 this might impact Play, too.

Play disables Akka's shutdown hook, and it stops the logging framework from a CoordinatedShutdown.PhaseBeforeActorSystemTerminate task. That might be too early, if the ActorSystem logs anything while terminating.

stops the logging framework from a CoordinatedShutdown.PhaseBeforeActorSystemTerminate task. That might be too early, if the ActorSystem logs anything while terminating.

yes, that might be too early. Might be better via ActorSystem.whenTerminated or the Future returned by CoordinatedShutdown.run.

For Akka itself we probably also have to consider that that logback can be shared by several ActorSystems in same JVM.

Play disables Akka's shutdown hook, and it stops the logging framework from a CoordinatedShutdown.PhaseBeforeActorSystemTerminate task. That might be too early, if the ActorSystem logs anything while terminating.

That code requires a review. The shutdown task should be renamed and the Logger should be stopped from somewhere else.

(better continue this discussion on an issue in playframework/playframework/.

Was this page helpful?
0 / 5 - 0 ratings