diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2020-07-21 12:53:03 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-21 21:00:22 +0000 |
commit | 11545c03ed7294b114613dfb168bc6bc42e99fe3 (patch) | |
tree | a620d70452ea774faff9d562cb4b7a931280c35c /src/mongo/logv2 | |
parent | 045e804b3d95082ee54de055e38d142ee8b56953 (diff) | |
download | mongo-11545c03ed7294b114613dfb168bc6bc42e99fe3.tar.gz |
SERVER-49320 only unconfigure the console when logging is fully configured
Diffstat (limited to 'src/mongo/logv2')
-rw-r--r-- | src/mongo/logv2/log_domain_global.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mongo/logv2/log_domain_global.cpp b/src/mongo/logv2/log_domain_global.cpp index b8429fb2609..194c297cbc4 100644 --- a/src/mongo/logv2/log_domain_global.cpp +++ b/src/mongo/logv2/log_domain_global.cpp @@ -157,14 +157,6 @@ Status LogDomainGlobal::Impl::configure(LogDomainGlobal::ConfigurationOptions co } #endif - if (options.consoleEnabled && _consoleSink.use_count() == 1) { - boost::log::core::get()->add_sink(_consoleSink); - } - - if (!options.consoleEnabled && _consoleSink.use_count() > 1) { - boost::log::core::get()->remove_sink(_consoleSink); - } - if (options.fileEnabled) { auto backend = boost::make_shared<RotatableFileBackend>( boost::make_shared<FileRotateSink>(options.timestampFormat), @@ -213,6 +205,16 @@ Status LogDomainGlobal::Impl::configure(LogDomainGlobal::ConfigurationOptions co _config = options; + if (options.consoleEnabled) { + if (_consoleSink.use_count() == 1) { + boost::log::core::get()->add_sink(_consoleSink); + } + } else { + if (_consoleSink.use_count() > 1) { + boost::log::core::get()->remove_sink(_consoleSink); + } + } + return Status::OK(); } |