summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-07-18 00:37:51 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-20 14:29:23 -0700
commit1a56bed50190e20999d28b7da8418927ecb8b041 (patch)
treee0350498338426b46ca96bd0bde8ac7e6b492afc /libglusterfs/src
parent7b8d2b38a12ed7e0a63ad9b1c38bfa20d8317b11 (diff)
added timestamp to crash dump log.
also did some minor enhancements in formating Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 151 (crash dump log should be in 'logviewer' friendly format) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=151
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/common-utils.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index c68fd306660..6dcc70900d0 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -276,7 +276,7 @@ gf_dump_config_flags (int fd)
int ret = 0;
/* TODO: 'ret' is not checked properly, add this later */
- ret = write (fd, "configuration details:\n", 22);
+ ret = write (fd, "configuration details:\n", 23);
/* have argp */
#ifdef HAVE_ARGP
@@ -372,9 +372,14 @@ void
gf_print_trace (int32_t signum)
{
extern FILE *gf_log_logfile;
- char msg[1024] = {0,};
- int fd = fileno (gf_log_logfile);
- int ret = 0;
+ struct tm *tm = NULL;
+ char msg[1024] = {0,};
+ char timestr[256] = {0,};
+ time_t utime = 0;
+ int ret = 0;
+ int fd = 0;
+
+ fd = fileno (gf_log_logfile);
/* Pending frames, (if any), list them in order */
ret = write (fd, "pending frames:\n", 16);
@@ -412,6 +417,16 @@ gf_print_trace (int32_t signum)
sprintf (msg, "signal received: %d\n", signum);
ret = write (fd, msg, strlen (msg));
+ {
+ /* Dump the timestamp of the crash too, so the previous logs
+ can be related */
+ utime = time (NULL);
+ tm = localtime (&utime);
+ strftime (timestr, 256, "%Y-%m-%d %H:%M:%S\n", tm);
+ ret = write (fd, "time of crash: ", 15);
+ ret = write (fd, timestr, strlen (timestr));
+ }
+
gf_dump_config_flags (fd);
#if HAVE_BACKTRACE
/* Print 'backtrace' */