From d24cac1ba4ed158da7bb79b63fbc398d804f1cb2 Mon Sep 17 00:00:00 2001 From: Yan Jun Date: Tue, 25 Sep 2018 16:29:13 +0800 Subject: [PATCH] global: fix err_to_stderr can't work when it was configured to false function `set_stderr_level(-1, -1)` set m_stderr_log and m_stderr_crash to -1, regardless of whether `err_to_stderr` is set to false or not, so logs will be always written to stderr. fix it as the same way as handle_conf_change does. Signed-off-by: Yan Jun --- src/global/global_init.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/global/global_init.cc b/src/global/global_init.cc index fc7e17704cc..56b9e685202 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -514,7 +514,8 @@ void global_init_chdir(const CephContext *cct) int global_init_shutdown_stderr(CephContext *cct) { reopen_as_null(cct, STDERR_FILENO); - cct->_log->set_stderr_level(-1, -1); + int l = cct->_conf->err_to_stderr ? -1 : -2; + cct->_log->set_stderr_level(l, l); return 0; } -- 2.39.5