summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/src/glfs.c2
-rw-r--r--cli/src/cli.c4
-rw-r--r--glusterfsd/src/glusterfsd.c2
-rw-r--r--libglusterfs/src/logging.c6
-rw-r--r--libglusterfs/src/logging.h6
-rw-r--r--libglusterfs/src/xlator.c2
-rw-r--r--tests/basic/logchecks.c6
-rw-r--r--xlators/debug/io-stats/src/io-stats.c4
-rw-r--r--xlators/debug/trace/src/trace.c2
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog.c2
-rw-r--r--xlators/meta/src/loglevel-file.c2
11 files changed, 17 insertions, 21 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index b168f682a7d..d6c05b76323 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -948,7 +948,7 @@ pub_glfs_set_logging (struct glfs *fs, const char *logfile, int loglevel)
/* finish log set parameters before init */
if (loglevel >= 0)
- gf_log_set_loglevel (loglevel);
+ gf_log_set_loglevel (fs->ctx, loglevel);
ret = gf_log_init (fs->ctx, tmplog, NULL);
if (ret)
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 2c3c06b507b..930182c65b7 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -179,8 +179,8 @@ logging_init (glusterfs_ctx_t *ctx, struct cli_state *state)
/* CLI should not have something to DEBUG after the release,
hence defaulting to INFO loglevel */
- gf_log_set_loglevel ((state->log_level == GF_LOG_NONE) ? GF_LOG_INFO :
- state->log_level);
+ gf_log_set_loglevel (ctx, (state->log_level == GF_LOG_NONE) ?
+ GF_LOG_INFO : state->log_level);
return 0;
}
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 921a86bfd65..db7720b1829 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1698,7 +1698,7 @@ logging_init (glusterfs_ctx_t *ctx, const char *progpath)
}
/* finish log set parameters before init */
- gf_log_set_loglevel (cmd_args->log_level);
+ gf_log_set_loglevel (ctx, cmd_args->log_level);
gf_log_set_localtime (cmd_args->localtime_logging);
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index 0f238d00738..6768082b6e6 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -131,12 +131,8 @@ gf_log_get_loglevel (void)
}
void
-gf_log_set_loglevel (gf_loglevel_t level)
+gf_log_set_loglevel (glusterfs_ctx_t *ctx, gf_loglevel_t level)
{
- glusterfs_ctx_t *ctx = NULL;
-
- ctx = THIS->ctx;
-
if (ctx)
ctx->log.loglevel = level;
}
diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h
index 6e433e203f9..665ab268dc6 100644
--- a/libglusterfs/src/logging.h
+++ b/libglusterfs/src/logging.h
@@ -279,10 +279,12 @@ int _gf_log_eh (const char *function, const char *fmt, ...);
gf_log (args); \
}
+struct _glusterfs_ctx;
+
void gf_log_disable_syslog (void);
void gf_log_enable_syslog (void);
gf_loglevel_t gf_log_get_loglevel (void);
-void gf_log_set_loglevel (gf_loglevel_t level);
+void gf_log_set_loglevel (struct _glusterfs_ctx *ctx, gf_loglevel_t level);
int gf_log_get_localtime (void);
void gf_log_set_localtime (int);
void gf_log_flush (void);
@@ -310,8 +312,6 @@ gf_log_set_log_buf_size (uint32_t buf_size);
void
gf_log_set_log_flush_timeout (uint32_t timeout);
-struct _glusterfs_ctx;
-
void
gf_log_flush_msgs (struct _glusterfs_ctx *ctx);
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 03495463a53..a342bbd7f33 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -1294,7 +1294,7 @@ is_gf_log_command (xlator_t *this, const char *name, char *value)
LG_MSG_SET_LOG_LEVEL,
"setting log level to %d (old-value=%d)",
log_level, gf_log_get_loglevel());
- gf_log_set_loglevel (log_level);
+ gf_log_set_loglevel (this->ctx, log_level);
ret = 0;
goto out;
}
diff --git a/tests/basic/logchecks.c b/tests/basic/logchecks.c
index 58b57003640..a40278b0d77 100644
--- a/tests/basic/logchecks.c
+++ b/tests/basic/logchecks.c
@@ -162,14 +162,14 @@ main (int argc, char *argv[])
/* TEST 6: Change level */
gf_msg ("logchecks", GF_LOG_ALERT, 0, logchecks_msg_11);
- gf_log_set_loglevel (GF_LOG_CRITICAL);
+ gf_log_set_loglevel (ctx, GF_LOG_CRITICAL);
gf_msg ("logchecks", GF_LOG_ALERT, 0, logchecks_msg_15);
go_log ();
gf_msg ("logchecks", GF_LOG_ALERT, 0, logchecks_msg_11);
/* Reset to run with syslog */
gf_log_set_logformat (gf_logformat_withmsgid);
- gf_log_set_loglevel (GF_LOG_INFO);
+ gf_log_set_loglevel (ctx, GF_LOG_INFO);
/* Run tests with logger changed to syslog */
/* TEST 7: No more gluster logs */
@@ -188,7 +188,7 @@ main (int argc, char *argv[])
/* TEST 9: Change level */
gf_msg ("logchecks", GF_LOG_ALERT, 0, logchecks_msg_11);
- gf_log_set_loglevel (GF_LOG_CRITICAL);
+ gf_log_set_loglevel (ctx, GF_LOG_CRITICAL);
gf_msg ("logchecks", GF_LOG_ALERT, 0, logchecks_msg_15);
go_log ();
gf_msg ("logchecks", GF_LOG_ALERT, 0, logchecks_msg_11);
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index c046aaae181..266f9449c9e 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -3856,7 +3856,7 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("log-level", log_str, options, str, out);
if (log_str) {
log_level = glusterd_check_log_level (log_str);
- gf_log_set_loglevel (log_level);
+ gf_log_set_loglevel (this->ctx, log_level);
}
GF_OPTION_RECONF ("logger", logger_str, options, str, out);
@@ -4038,7 +4038,7 @@ init (xlator_t *this)
if (log_str) {
log_level = glusterd_check_log_level (log_str);
if (DEFAULT_LOG_LEVEL != log_level)
- gf_log_set_loglevel (log_level);
+ gf_log_set_loglevel (this->ctx, log_level);
}
GF_OPTION_INIT ("logger", logger_str, str, out);
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index 3ad3769afd8..c85f2a7a994 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -3260,7 +3260,7 @@ init (xlator_t *this)
}
setloglevel:
- gf_log_set_loglevel (conf->trace_log_level);
+ gf_log_set_loglevel (this->ctx, conf->trace_log_level);
this->private = conf;
ret = 0;
out:
diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c
index 6ee87b1414e..6ad6c63740d 100644
--- a/xlators/features/changelog/lib/src/gf-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-changelog.c
@@ -431,7 +431,7 @@ gf_changelog_setup_logging (xlator_t *this, char *logfile, int loglevel)
if (gf_log_init (this->ctx, logfile, NULL))
return -1;
- gf_log_set_loglevel ((loglevel == -1) ? GF_LOG_INFO :
+ gf_log_set_loglevel (this->ctx, (loglevel == -1) ? GF_LOG_INFO :
loglevel);
return 0;
}
diff --git a/xlators/meta/src/loglevel-file.c b/xlators/meta/src/loglevel-file.c
index f9c5a993d73..4399da2c948 100644
--- a/xlators/meta/src/loglevel-file.c
+++ b/xlators/meta/src/loglevel-file.c
@@ -32,7 +32,7 @@ loglevel_file_write (xlator_t *this, fd_t *fd, struct iovec *iov, int count)
level = strtol (iov[0].iov_base, NULL, 0);
if (level >= GF_LOG_NONE && level <= GF_LOG_TRACE)
- gf_log_set_loglevel (level);
+ gf_log_set_loglevel (this->ctx, level);
return iov_length (iov, count);
}