]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
global: fix err_to_stderr can't work when it was configured to false
authorYan Jun <yan.jun8@zte.com.cn>
Tue, 25 Sep 2018 08:29:13 +0000 (16:29 +0800)
committerYan Jun <yan.jun8@zte.com.cn>
Tue, 16 Oct 2018 12:32:10 +0000 (20:32 +0800)
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 <yan.jun8@zte.com.cn>
src/global/global_init.cc

index fc7e17704ccf6bf2a48626e973b75c5e24a6dfae..56b9e685202b66c4daf359f53815c39c51af6d4f 100644 (file)
@@ -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;
 }