messages: set the "discard" logger when exiting
Normally closing a logger should not incur new log messages, but... the early logger does exactly that, and this prevents it from looping infinitely into itself. This situation occurs if no proper logger was installed until the log switch was destroyed.
Fixes #26363 (closed).
This effectively reverts commit e8700cbd.
Edited by Rémi Denis-Courmont