From eb9e6197e08caad5fe2f4a9a39fb6f6d685066f3 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Mon, 7 Feb 2011 05:43:56 -0800 Subject: [PATCH] dout: force reopen after conf read, fg logging set After the configuration is read, or a program sets foreground logging, force those changes to be applied to the dout() configuration. Signed-off-by: Colin McCabe --- src/common/common_init.cc | 2 +- src/common/debug.cc | 1 - src/config.cc | 7 +++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/common_init.cc b/src/common/common_init.cc index fc4736b61f32..a4fcae1d4e0e 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -48,7 +48,7 @@ void set_foreground_logging() g_conf.log_to_file = false; - if (_dout_need_open) { + { Mutex::Locker l(_dout_lock); _dout_open_log(false); } diff --git a/src/common/debug.cc b/src/common/debug.cc index 249e55699c2b..fe41cce42f6c 100644 --- a/src/common/debug.cc +++ b/src/common/debug.cc @@ -27,7 +27,6 @@ Mutex _dout_lock __attribute__((init_priority(110))) void _dout_open_log(bool print_version) { - assert(_dout_need_open); assert(_dout_lock.is_locked()); if (!_doss) { diff --git a/src/config.cc b/src/config.cc index 72a8820c98b0..d8e26fe781fa 100644 --- a/src/config.cc +++ b/src/config.cc @@ -1096,6 +1096,13 @@ void parse_startup_config_options(std::vector& args, const char *mo if (force_foreground_logging) { set_foreground_logging(); } + else { + // In the long term, it would be best to ensure that we read ceph.conf + // before initializing dout(). For now, just force a reopen here with the + // configuration we have just read. + Mutex::Locker l(_dout_lock); + _dout_open_log(false); + } if (!cf) return; -- 2.47.3