diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2014-03-11 15:05:44 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-04-11 18:00:54 -0700 |
commit | 712541cdefcc9614e5a79f628358f205ceda6e55 (patch) | |
tree | d2ba17083d16f1cacc80c7498ba0534d7ef16baf /xlators/debug | |
parent | e73af16885f6d11ebcb225edb4d12214ceeba74c (diff) |
logging: Make logger and log format configurable through cli
Change-Id: Ic4b701a6621578848ff67ae4ecb5a10b5f32f93b
BUG: 1075611
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/7372
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/debug')
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 9e48a7c6eca..d63fbb26c4f 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -2666,9 +2666,13 @@ reconfigure (xlator_t *this, dict_t *options) struct ios_conf *conf = NULL; int ret = -1; char *sys_log_str = NULL; + char *log_format_str = NULL; + char *logger_str = NULL; int sys_log_level = -1; char *log_str = NULL; int log_level = -1; + int log_format = -1; + int logger = -1; if (!this || !this->private) goto out; @@ -2696,6 +2700,18 @@ reconfigure (xlator_t *this, dict_t *options) gf_log_set_loglevel (log_level); } + GF_OPTION_RECONF ("logger", logger_str, options, str, out); + if (logger_str) { + logger = gf_check_logger (logger_str); + gf_log_set_logger (logger); + } + + GF_OPTION_RECONF ("log-format", log_format_str, options, str, out); + if (log_format_str) { + log_format = gf_check_log_format (log_format_str); + gf_log_set_logformat (log_format); + } + ret = 0; out: gf_log (this->name, GF_LOG_DEBUG, "reconfigure returning %d", ret); @@ -2727,6 +2743,10 @@ init (xlator_t *this) { struct ios_conf *conf = NULL; char *sys_log_str = NULL; + char *logger_str = NULL; + char *log_format_str = NULL; + int logger = -1; + int log_format = -1; int sys_log_level = -1; char *log_str = NULL; int log_level = -1; @@ -2785,6 +2805,19 @@ init (xlator_t *this) gf_log_set_loglevel (log_level); } + GF_OPTION_INIT ("logger", logger_str, str, out); + if (logger_str) { + logger = gf_check_logger (logger_str); + gf_log_set_logger (logger); + } + + GF_OPTION_INIT ("log-format", log_format_str, str, out); + if (log_format_str) { + log_format = gf_check_log_format (log_format_str); + gf_log_set_logformat (log_format); + } + + this->private = conf; ret = 0; out: @@ -3027,6 +3060,40 @@ struct volume_options options[] = { .value = { "DEBUG", "WARNING", "ERROR", "INFO", "CRITICAL", "NONE", "TRACE"} }, + { .key = {"logger"}, + .type = GF_OPTION_TYPE_STR, + .value = { GF_LOGGER_GLUSTER_LOG, GF_LOGGER_SYSLOG} + }, + { .key = {"client-logger"}, + .type = GF_OPTION_TYPE_STR, + .default_value = GF_LOGGER_GLUSTER_LOG, + .description = "Changes the logging sub-system to log to, for the " + "clients", + .value = { GF_LOGGER_GLUSTER_LOG, GF_LOGGER_SYSLOG} + }, + { .key = {"brick-logger"}, + .type = GF_OPTION_TYPE_STR, + .default_value = GF_LOGGER_GLUSTER_LOG, + .description = "Changes the logging sub-system to log to, for the " + "bricks", + .value = { GF_LOGGER_GLUSTER_LOG, GF_LOGGER_SYSLOG} + }, + { .key = {"log-format"}, + .type = GF_OPTION_TYPE_STR, + .value = { GF_LOG_FORMAT_NO_MSG_ID, GF_LOG_FORMAT_WITH_MSG_ID} + }, + { .key = {"client-log-format"}, + .type = GF_OPTION_TYPE_STR, + .default_value = GF_LOG_FORMAT_WITH_MSG_ID, + .description = "Changes log format for the clients", + .value = { GF_LOG_FORMAT_NO_MSG_ID, GF_LOG_FORMAT_WITH_MSG_ID} + }, + { .key = {"brick-log-format"}, + .type = GF_OPTION_TYPE_STR, + .default_value = GF_LOG_FORMAT_WITH_MSG_ID, + .description = "Changes the log format for the bricks", + .value = { GF_LOG_FORMAT_NO_MSG_ID, GF_LOG_FORMAT_WITH_MSG_ID} + }, { .key = {NULL} }, }; |