summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-06-23 03:20:09 +0000
committerAnand Avati <avati@gluster.com>2011-07-11 23:19:28 -0700
commite9c29f722776a91993403428cafdb2b7e1056bd8 (patch)
tree5da405deff3a30d4e063d0bfa3cedc47af6fb790 /xlators/debug/io-stats
parent089ae1b7299f2d30a7b56da0c700f42d7a0341d7 (diff)
debug/io-stats: Added sys-log-level option.
Signed-off-by: Junaid <junaid@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 3044 (provide option to set syslog loglevel through CLI) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3044
Diffstat (limited to 'xlators/debug/io-stats')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 326645cf36d..401431d0542 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 <stdarg.h>
#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;
}
@@ -2646,5 +2666,9 @@ struct volume_options options[] = {
.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} },
};