summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2016-08-08 13:11:29 -0400
committerNiels de Vos <ndevos@redhat.com>2017-01-02 11:51:02 -0800
commit1e421a5bbf075994882a1fefe1099bf6622d90f6 (patch)
tree16452785309f27b1fb87e60f0a23a255dea474a2
parent1d03b1b6b48e4ee9260852b35ec827f203e2287c (diff)
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. Backport of: > 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 > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Smoke: Gluster Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Niels de Vos <ndevos@redhat.com> > Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Change-Id: I1f74d94ef8068b95ec696638c0a8b17d8d71aabe BUG: 1378384 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Reviewed-on: http://review.gluster.org/15544 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--libglusterfs/src/ctx.c2
-rw-r--r--xlators/debug/io-stats/src/io-stats.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/libglusterfs/src/ctx.c b/libglusterfs/src/ctx.c
index 2aa14654b9e..b009e6270a2 100644
--- a/libglusterfs/src/ctx.c
+++ b/libglusterfs/src/ctx.c
@@ -35,6 +35,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 62e85bbb99b..c21417a0192 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -3694,7 +3694,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);