summaryrefslogtreecommitdiff
path: root/src/mongo/logv2
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2021-09-15 16:24:38 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-15 21:07:50 +0000
commit7e319bd3940ee5f4d32d84f63c7b8516346a7c99 (patch)
tree58539a9b286c44cd079b711dba97f78ecfa74d65 /src/mongo/logv2
parent7375f66262489f5e93c9342ea57cf974b8a87a9b (diff)
downloadmongo-7e319bd3940ee5f4d32d84f63c7b8516346a7c99.tar.gz
SERVER-59718 Guard tenantID callback against shutdown destruction ordering
Diffstat (limited to 'src/mongo/logv2')
-rw-r--r--src/mongo/logv2/log_detail.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/logv2/log_detail.cpp b/src/mongo/logv2/log_detail.cpp
index a5bdb00f866..1a0f4edab3b 100644
--- a/src/mongo/logv2/log_detail.cpp
+++ b/src/mongo/logv2/log_detail.cpp
@@ -39,16 +39,17 @@
#include "mongo/logv2/log_domain_internal.h"
#include "mongo/logv2/log_options.h"
#include "mongo/logv2/log_source.h"
+#include "mongo/util/static_immortal.h"
#include "mongo/util/testing_proctor.h"
namespace mongo::logv2::detail {
namespace {
GetTenantIDFn& getTenantID() {
// Ensure that we avoid undefined initialization ordering
- // when logging occurs during process init.
+ // when logging occurs during process init and shutdown.
// See logv2_test.cpp
- static GetTenantIDFn fn;
- return fn;
+ static StaticImmortal<GetTenantIDFn> fn;
+ return *fn;
}
} // namespace