Blob Blame History Raw
From 483b8a539824dd9dcce6f31b00c630c7ff238489 Mon Sep 17 00:00:00 2001
From: Vijay Bellur <vbellur@redhat.com>
Date: Mon, 8 Aug 2016 13:11:29 -0400
Subject: [PATCH 688/689] logging: Avoid re-initing log level in io-stats

If log level is already set via api or command line, initialization of
io-stats xlator overwrites the log level to GF_LOG_INFO. This patch
prevents re-initialization of log level if already set.

>Change-Id: I1f74d94ef8068b95ec696638c0a8b17d8d71aabe
>BUG: 1368882
>Signed-off-by: Vijay Bellur <vbellur@redhat.com>
>Reported-by: Colin Lord <clord@redhat.com>
>Reviewed-on: http://review.gluster.org/15112
>Reviewed-by: Niels de Vos <ndevos@redhat.com>
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>

Change-Id: I1f74d94ef8068b95ec696638c0a8b17d8d71aabe
BUG: 1597509
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/143803
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 libglusterfs/src/ctx.c                | 2 ++
 xlators/debug/io-stats/src/io-stats.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libglusterfs/src/ctx.c b/libglusterfs/src/ctx.c
index 35f1928..29849e2 100644
--- a/libglusterfs/src/ctx.c
+++ b/libglusterfs/src/ctx.c
@@ -37,6 +37,8 @@ glusterfs_ctx_new ()
 	ctx->daemon_pipe[0] = -1;
 	ctx->daemon_pipe[1] = -1;
 
+        ctx->log.loglevel = DEFAULT_LOG_LEVEL;
+
         /* lock is never destroyed! */
 	ret = LOCK_INIT (&ctx->lock);
 	if (ret) {
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 92f05e5..6f4206a 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -3991,7 +3991,8 @@ init (xlator_t *this)
         GF_OPTION_INIT ("log-level", log_str, str, out);
         if (log_str) {
                 log_level = glusterd_check_log_level (log_str);
-                gf_log_set_loglevel (log_level);
+                if (DEFAULT_LOG_LEVEL != log_level)
+                        gf_log_set_loglevel (log_level);
         }
 
         GF_OPTION_INIT ("logger", logger_str, str, out);
-- 
1.8.3.1