From 30e49ae28b7a9cce6b489e1c866b35ac6ec8b70d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 3 Apr 2019 14:54:55 -0500 Subject: [PATCH] common/common_init: start log from common_init_finish (if not yet started) This captures any non-global_init users who created their cct but haven't started up the log thread yet. As long as common_init_finish() happens after we have all of our config options (from the mon config or whatever), we will log (or not log) to the right location(s). Fixes a regression in cd6a5b9c40779956629803f222c365bdb291a169 Signed-off-by: Sage Weil --- src/common/common_init.cc | 4 ++++ src/log/Log.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/common/common_init.cc b/src/common/common_init.cc index 9dd6be89b90c9..092804931be0b 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -106,6 +106,10 @@ void common_init_finish(CephContext *cct) cct->init_crypto(); ZTracer::ztrace_init(); + if (!cct->_log->is_started()) { + cct->_log->start(); + } + int flags = cct->get_init_flags(); if (!(flags & CINIT_FLAG_NO_DAEMON_ACTIONS)) cct->start_service_thread(); diff --git a/src/log/Log.h b/src/log/Log.h index ac10cf9047d95..a0b12e2743231 100644 --- a/src/log/Log.h +++ b/src/log/Log.h @@ -82,6 +82,8 @@ class Log : private Thread void _log_message(const char *s, bool crash); public: + using Thread::is_started; + Log(const SubsystemMap *s); ~Log() override; -- 2.39.5