1
0
mirror of https://github.com/ceph/ceph synced 2025-04-01 14:51:13 +00:00

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 <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-07-16 16:02:14 -07:00
parent 64f745008b
commit 52f96b9fd1

View File

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