summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-08-31 04:10:17 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-08-31 07:43:57 -0700
commit4ae3853d857e584189289b33f8ba929fbd9cc7e1 (patch)
tree4527a1a6ea019bc6a5198da01723c6f7c660203a /xlators
parentcd5d2fc036003eb0c1a7f91755d3f5aa327067b4 (diff)
Add command logging facility for glusterd
Added new command logging facility to gf_cmd_log() which can be used to log all commands to a .cmd_log_history file situated in the glusterd working directory. Accepts 1 st argument a domain string (e.g: volume, peer..) followed by msg string (similar to gf_log) Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1404 (need a dump of all the op/mgmt commands) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1404
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index d23f06190..a038bc698 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -232,7 +232,7 @@ init (xlator_t *this)
int port_num = 0;
char voldir [PATH_MAX] = {0,};
char dirname [PATH_MAX];
-
+ char cmd_log_filename [PATH_MAX] = {0,};
dir_data = dict_get (this->options, "working-directory");
@@ -273,6 +273,15 @@ init (xlator_t *this)
gf_log (this->name, GF_LOG_NORMAL, "Using %s as working directory",
dirname);
+ snprintf (cmd_log_filename, PATH_MAX,"%s/.cmd_log_history",dirname);
+ ret = gf_cmd_log_init (cmd_log_filename);
+
+ if (ret == -1) {
+ gf_log ("this->name", GF_LOG_CRITICAL,
+ "Unable to create cmd log file %s", cmd_log_filename);
+ exit (1);
+ }
+
snprintf (voldir, PATH_MAX, "%s/vols", dirname);
ret = mkdir (voldir, 0777);