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>
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;
}