From 95a345cc3f19a4762c68a40c7dd283ba0772ee11 Mon Sep 17 00:00:00 2001 From: Henrik Edin Date: Mon, 24 Feb 2020 11:19:20 -0500 Subject: SERVER-46008 Fix so logging works during global shutdown --- src/mongo/logv2/log_source.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/mongo/logv2/log_source.h') diff --git a/src/mongo/logv2/log_source.h b/src/mongo/logv2/log_source.h index 25eea5c36b4..99269bcdba2 100644 --- a/src/mongo/logv2/log_source.h +++ b/src/mongo/logv2/log_source.h @@ -57,7 +57,7 @@ private: basic_logger; public: - LogSource(const LogDomain::Internal* domain) + explicit LogSource(const LogDomain::Internal* domain, bool isShutdown) : _domain(domain), _severity(LogSeverity::Log()), _component(LogComponent::kDefault), @@ -73,11 +73,14 @@ public: add_attribute_unlocked(attributes::timeStamp(), boost::log::attributes::make_function([]() { return Date_t::now(); })); - add_attribute_unlocked( - attributes::threadName(), - boost::log::attributes::make_function([]() { return getThreadName(); })); + add_attribute_unlocked(attributes::threadName(), + boost::log::attributes::make_function([isShutdown]() { + return isShutdown ? "shutdown"_sd : getThreadName(); + })); } + explicit LogSource(const LogDomain::Internal* domain) : LogSource(domain, false) {} + boost::log::record open_record(int32_t id, LogSeverity severity, LogComponent component, -- cgit v1.2.1