Spark registers some shutdown hooks, and they log messages during shutdown:
Since the Logging trait creates SLF4J loggers lazily:
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:
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.