From e9c29f722776a91993403428cafdb2b7e1056bd8 Mon Sep 17 00:00:00 2001 From: Junaid Date: Thu, 23 Jun 2011 03:20:09 +0000 Subject: debug/io-stats: Added sys-log-level option. Signed-off-by: Junaid Signed-off-by: Anand Avati BUG: 3044 (provide option to set syslog loglevel through CLI) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3044 --- xlators/debug/io-stats/src/io-stats.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xlators/debug/io-stats/src/io-stats.c') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 326645cf3..401431d05 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -45,6 +45,7 @@ #include "io-stats-mem-types.h" #include #include "defaults.h" +#include "logging.h" #define MAX_LIST_MEMBERS 100 @@ -2306,6 +2307,8 @@ iostats_configure_options (xlator_t *this, dict_t *options, struct ios_conf *conf) { int ret = 0; + int sys_log_level = -1; + char *sys_log_str = NULL; char *log_str = NULL; GF_ASSERT (this); @@ -2359,6 +2362,23 @@ iostats_configure_options (xlator_t *this, dict_t *options, "changing log-level to %s", log_str); } } + + ret = dict_get_str (options, "sys-log-level", &sys_log_str); + if (!ret) { + sys_log_level = glusterd_check_log_level (sys_log_str); + } + + if (ret < 0 || sys_log_level == -1) { + sys_log_level = glusterd_check_log_level ("CRITICAL"); + gf_log (this->name, GF_LOG_WARNING, + "setting sys-log-level to CRITICAL"); + } else { + gf_log (this->name, GF_LOG_WARNING, + "setting sys-log-level to %s", sys_log_str); + } + + set_sys_log_level (sys_log_level); + return 0; } @@ -2645,6 +2665,10 @@ struct volume_options options[] = { { .key = {"log-level"}, .type = GF_OPTION_TYPE_STR, .value = { "DEBUG", "WARNING", "ERROR", "CRITICAL", "NONE", "TRACE"} + }, + { .key = {"sys-log-level"}, + .type = GF_OPTION_TYPE_STR, + .value = { "WARNING", "ERROR", "CRITICAL"} }, { .key = {NULL} }, }; -- cgit