79 lines
3.2 KiB
Diff
79 lines
3.2 KiB
Diff
From 1d8fd2540ccf254d90e831f612415226043fc5b3 Mon Sep 17 00:00:00 2001
|
|
From: "Gao,Yan" <ygao@suse.com>
|
|
Date: Fri, 27 Apr 2018 13:41:00 +0200
|
|
Subject: [PATCH] Log: change sbd's default logging level to LOG_NOTICE
|
|
|
|
With the refactoring of logging parts and 1ee3503c, sbd became too
|
|
silent given the default logging level LOG_WARNING, even under the
|
|
situations where it's supposed to tell something.
|
|
|
|
This commit changes sbd's default logging level to LOG_NOTICE.
|
|
Meanwhile pacemaker library's logging level remains at LOG_WARNING.
|
|
With "-v", sbd's logging level is set to LOG_INFO.
|
|
With "-vv", sbd's logging level is set to LOG_DEBUG.
|
|
With "-vvv", both sbd's and pacemaker library's logging levels are set
|
|
to LOG_DEBUG.
|
|
---
|
|
src/sbd-inquisitor.c | 28 ++++++++++++++++++++++------
|
|
1 file changed, 22 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c
|
|
index 59408b3..237bf43 100644
|
|
--- a/src/sbd-inquisitor.c
|
|
+++ b/src/sbd-inquisitor.c
|
|
@@ -803,6 +803,19 @@ parse_device_line(const char *line)
|
|
return found;
|
|
}
|
|
|
|
+#define SBD_SOURCE_FILES "sbd-cluster.c,sbd-common.c,sbd-inquisitor.c,sbd-md.c,sbd-pacemaker.c,setproctitle.c"
|
|
+
|
|
+static void
|
|
+sbd_log_filter_ctl(const char *files, uint8_t priority)
|
|
+{
|
|
+ if (files == NULL) {
|
|
+ files = SBD_SOURCE_FILES;
|
|
+ }
|
|
+
|
|
+ qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, files, priority);
|
|
+ qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, files, priority);
|
|
+}
|
|
+
|
|
int
|
|
arg_enabled(int arg_count)
|
|
{
|
|
@@ -834,6 +847,7 @@ int main(int argc, char **argv, char **envp)
|
|
|
|
qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_TRUE);
|
|
qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_FALSE);
|
|
+ sbd_log_filter_ctl(NULL, LOG_NOTICE);
|
|
|
|
sbd_get_uname();
|
|
|
|
@@ -926,15 +940,17 @@ int main(int argc, char **argv, char **envp)
|
|
case 'v':
|
|
debug++;
|
|
if(debug == 1) {
|
|
- qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "sbd-common.c,sbd-inquisitor.c,sbd-md.c,sbd-pacemaker.c", LOG_DEBUG);
|
|
- qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "sbd-common.c,sbd-inquisitor.c,sbd-md.c,sbd-pacemaker.c", LOG_DEBUG);
|
|
- cl_log(LOG_INFO, "Verbose mode enabled.");
|
|
+ sbd_log_filter_ctl(NULL, LOG_INFO);
|
|
+ cl_log(LOG_INFO, "Verbose mode enabled.");
|
|
|
|
} else if(debug == 2) {
|
|
+ sbd_log_filter_ctl(NULL, LOG_DEBUG);
|
|
+ cl_log(LOG_INFO, "Debug mode enabled.");
|
|
+
|
|
+ } else if(debug == 3) {
|
|
/* Go nuts, turn on pacemaker's logging too */
|
|
- qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_DEBUG);
|
|
- qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_DEBUG);
|
|
- cl_log(LOG_INFO, "Verbose library mode enabled.");
|
|
+ sbd_log_filter_ctl("*", LOG_DEBUG);
|
|
+ cl_log(LOG_INFO, "Debug library mode enabled.");
|
|
}
|
|
break;
|
|
case 'T':
|
|
--
|
|
1.8.3.1
|
|
|