summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.c
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2017-08-01 08:04:48 -0400
committerShyamsundar Ranganathan <srangana@redhat.com>2017-08-03 12:03:18 +0000
commitf68887999e89d894c3125e3b26517221ad1543fc (patch)
tree36a9371653aaa939d2781735103182fd6081387b /xlators/mgmt/glusterd/src/glusterd.c
parentc7e5741f938e24b85976bf78ea7d84984a4e1e61 (diff)
logging: localtime logging, cmdline, volume set option
Despite the fact that appliances generally use UTC, some users really want log entries in localtime. fixes gluster/glusterfs#272 feature page: https://review.gluster.org/17807 Change-Id: I5fbf2c3eedd9eb128fb3f851dd67b2f4081c8bba Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: https://review.gluster.org/16911 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index f8a38f965a6..68998f0a877 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1401,6 +1401,7 @@ init (xlator_t *this)
int32_t workers = 0;
gf_boolean_t upgrade = _gf_false;
gf_boolean_t downgrade = _gf_false;
+ char *localtime_logging = NULL;
#ifndef GF_DARWIN_HOST_OS
{
@@ -1846,6 +1847,25 @@ init (xlator_t *this)
if (ret < 0)
goto out;
+ if (dict_get_str (conf->opts, GLUSTERD_LOCALTIME_LOGGING_KEY,
+ &localtime_logging) == 0) {
+ int already_enabled = gf_log_get_localtime ();
+
+ if (strcmp (localtime_logging, "enable") == 0) {
+ gf_log_set_localtime (1);
+ if (!already_enabled)
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_LOCALTIME_LOGGING_ENABLE,
+ "localtime logging enable");
+ } else if (strcmp (localtime_logging, "disable") == 0) {
+ gf_log_set_localtime (0);
+ if (already_enabled)
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_LOCALTIME_LOGGING_DISABLE,
+ "localtime logging disable");
+ }
+ }
+
conf->blockers = 0;
/* If the peer count is less than 2 then this would be the best time to
* spawn process/bricks that may need (re)starting since last time