From: Yan Jun Date: Tue, 25 Sep 2018 08:29:13 +0000 (+0800) Subject: global: fix err_to_stderr can't work when it was configured to false X-Git-Tag: v14.1.0~1168^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d24cac1ba4ed158da7bb79b63fbc398d804f1cb2;p=ceph.git 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 --- diff --git a/src/global/global_init.cc b/src/global/global_init.cc index fc7e17704ccf..56b9e685202b 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; }