From de524abdb1da2e5476ad98f1daad1f0b1969c9c2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 16 Jul 2012 15:40:03 -0700 Subject: [PATCH] log: dump logging levels in crash dump So you know what you are/are not seeing. Signed-off-by: Sage Weil --- src/log/Log.cc | 21 +++++++++++++++++++++ src/log/SubsystemMap.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/log/Log.cc b/src/log/Log.cc index f029390f5a5..6fe07e79a66 100644 --- a/src/log/Log.cc +++ b/src/log/Log.cc @@ -258,6 +258,27 @@ void Log::dump_recent() EntryQueue old; _log_message("--- begin dump of recent events ---", true); _flush(&m_recent, &old, true); + + char buf[4096]; + _log_message("--- logging levels ---", true); + for (vector::iterator p = m_subs->m_subsys.begin(); + p != m_subs->m_subsys.end(); + ++p) { + snprintf(buf, sizeof(buf), " %2d/%2d %s", p->log_level, p->gather_level, p->name.c_str()); + _log_message(buf, true); + } + + sprintf(buf, " %2d/%2d (syslog threshold)", m_syslog_log, m_syslog_crash); + _log_message(buf, true); + sprintf(buf, " %2d/%2d (stderr threshold)", m_stderr_log, m_stderr_crash); + _log_message(buf, true); + sprintf(buf, " max_recent %9d", m_max_recent); + _log_message(buf, true); + sprintf(buf, " max_new %9d", m_max_new); + _log_message(buf, true); + sprintf(buf, " log_file %s", m_log_file.c_str()); + _log_message(buf, true); + _log_message("--- end dump of recent events ---", true); pthread_mutex_unlock(&m_flush_mutex); diff --git a/src/log/SubsystemMap.h b/src/log/SubsystemMap.h index d40552de2c1..16b6b72c6a6 100644 --- a/src/log/SubsystemMap.h +++ b/src/log/SubsystemMap.h @@ -23,6 +23,8 @@ class SubsystemMap { std::vector m_subsys; unsigned m_max_name_len; + friend class Log; + public: SubsystemMap() : m_max_name_len(0) {}