summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-02-25 15:37:55 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-04 03:12:44 -0800
commitdc3e568cfa5a37e531a18f2b3628b28fbcb41f1a (patch)
tree691536715c2f4cbd6744355452dcc9acd7bf5d6c
parent3f467f4464755989db4d22da04ae1cb895d2db11 (diff)
trace: Support new option: force-log-level
trace has till now forced the log level to be set to NORMAL. This masks other log output that we might need to observed in combination with the trace output. This new option allows us to force the log-level to something other than NORMAL. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 168 (trace does not output debug messages) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=168
-rw-r--r--xlators/debug/trace/src/trace.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index fb86fc680..e559bf8b5 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -57,6 +57,7 @@ struct {
int enabled;
} trace_fop_names[GF_FOP_MAXVALUE];
+int trace_log_level = GF_LOG_NORMAL;
static char *
trace_stat_to_str (struct stat *stbuf)
@@ -2048,6 +2049,7 @@ init (xlator_t *this)
{
dict_t *options = NULL;
char *includes = NULL, *excludes = NULL;
+ char *forced_loglevel = NULL;
if (!this)
return -1;
@@ -2087,8 +2089,30 @@ init (xlator_t *this)
if (excludes)
process_call_list (excludes, 0);
- if (gf_log_get_loglevel () < GF_LOG_NORMAL)
- gf_log_set_loglevel (GF_LOG_NORMAL);
+ if (dict_get (options, "force-log-level")) {
+ forced_loglevel = data_to_str (dict_get (options,
+ "force-log-level"));
+ if (!forced_loglevel)
+ goto setloglevel;
+
+ if (strcmp (forced_loglevel, "NORMAL") == 0)
+ trace_log_level = GF_LOG_NORMAL;
+ else if (strcmp (forced_loglevel, "TRACE") == 0)
+ trace_log_level = GF_LOG_TRACE;
+ else if (strcmp (forced_loglevel, "ERROR") == 0)
+ trace_log_level = GF_LOG_ERROR;
+ else if (strcmp (forced_loglevel, "DEBUG") == 0)
+ trace_log_level = GF_LOG_DEBUG;
+ else if (strcmp (forced_loglevel, "WARNING") == 0)
+ trace_log_level = GF_LOG_WARNING;
+ else if (strcmp (forced_loglevel, "CRITICAL") == 0)
+ trace_log_level = GF_LOG_CRITICAL;
+ else if (strcmp (forced_loglevel, "NONE") == 0)
+ trace_log_level = GF_LOG_NONE;
+ }
+
+setloglevel:
+ gf_log_set_loglevel (trace_log_level);
return 0;
}