]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
log: apply log_level to stderr/syslog logic
authorSage Weil <sage@inktank.com>
Mon, 16 Jul 2012 23:02:14 +0000 (16:02 -0700)
committerSage Weil <sage@inktank.com>
Mon, 16 Jul 2012 23:14:11 +0000 (16:14 -0700)
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>
src/log/Log.cc

index f029390f5a5e5d3641f0d35d45c8abbaca84783e..7c54534b0b4e5954e45d16b99a18fc3a7c2d0cd6 100644 (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;