diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-02-24 11:19:20 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-26 22:09:44 +0000 |
commit | 95a345cc3f19a4762c68a40c7dd283ba0772ee11 (patch) | |
tree | 96fed9d0fdf1e04568cc99df8fc7285722796e4b /src/mongo/logv2/log_source.h | |
parent | b88b28fccb697a020368c6a056f9987e4ff91206 (diff) | |
download | mongo-95a345cc3f19a4762c68a40c7dd283ba0772ee11.tar.gz |
SERVER-46008 Fix so logging works during global shutdown
Diffstat (limited to 'src/mongo/logv2/log_source.h')
-rw-r--r-- | src/mongo/logv2/log_source.h | 11 |
1 files changed, 7 insertions, 4 deletions
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<char, LogSource, boost::log::sources::single_thread_model>; 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, |