The pointer returned by '_logger()' can be a nullptr, in particular while tracing is (temporarily) inhibited. This patch ensures that the 'Thread::trace' accessors never operate on a nullptr. Fixes #5410