From: Sage Weil Date: Mon, 16 Jul 2012 23:02:14 +0000 (-0700) Subject: log: apply log_level to stderr/syslog logic X-Git-Tag: v0.49~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=52f96b9fd1a358956b0331e3e194c8a752d2ee5a;p=ceph.git log: apply log_level to stderr/syslog logic In non-crash situations, we want to make sure the message is both below the syslog/stderr threshold and also below the normal log threshold. Otherwise we get anything we gather on those channels, even when the log level is low. Signed-off-by: Sage Weil --- diff --git a/src/log/Log.cc b/src/log/Log.cc index f029390f5a5e..7c54534b0b4e 100644 --- a/src/log/Log.cc +++ b/src/log/Log.cc @@ -188,9 +188,12 @@ void Log::_flush(EntryQueue *t, EntryQueue *requeue, bool crash) while ((e = t->dequeue()) != NULL) { unsigned sub = e->m_subsys; - bool do_fd = m_fd >= 0 && (crash || m_subs->get_log_level(sub) >= e->m_prio); - bool do_syslog = (crash ? m_syslog_crash : m_syslog_log) >= e->m_prio; - bool do_stderr = (crash ? m_stderr_crash : m_stderr_log) >= e->m_prio; + bool should_log = m_subs->get_log_level(sub) >= e->m_prio; + bool do_fd = m_fd >= 0 && (crash || should_log); + bool do_syslog = crash ? (m_syslog_crash >= e->m_prio) : + (m_syslog_crash >= e->m_prio && should_log); + bool do_stderr = crash ? (m_stderr_crash >= e->m_prio) : + (m_stderr_crash >= e->m_prio && should_log); if (do_fd || do_syslog || do_stderr) { int buflen = 0;