From 342ae52c816aeb087bd4d32424baa6cc60ee1166 Mon Sep 17 00:00:00 2001 From: Jeffrey Hutzelman Date: Tue, 9 Oct 2001 06:27:31 +0000 Subject: [PATCH] logging-enhancements-20011009 The bosserver now logs the exit status of processes under its control. ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== Messages generated as the result of assertion failures now include timestamps. --- src/bozo/bnode.c | 14 ++++++++++++++ src/util/assert.c | 9 ++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/bozo/bnode.c b/src/bozo/bnode.c index b52f5667b4..b401b46e71 100644 --- a/src/bozo/bnode.c +++ b/src/bozo/bnode.c @@ -528,6 +528,12 @@ static int bproc() { RememberProcName(tp); tb->errorSignal = 0; } + if (tp->coreName) + bozo_Log("%s:%s exited with code %d", + tb->name, tp->coreName, tp->lastExit); + else + bozo_Log("%s exited with code %d", + tb->name, tp->lastExit); } else { /* Signal occurred, perhaps spurious due to shutdown request. @@ -542,6 +548,14 @@ static int bproc() { tb->lastErrorExit = FT_ApproxTime(); RememberProcName(tp); } + if (tp->coreName) + bozo_Log("%s:%s exited on signal %d%s", + tb->name, tp->coreName, tp->lastSignal, + WCOREDUMP(status) ? " (core dumped)" : ""); + else + bozo_Log("%s exited on signal %d%s", + tb->name, tp->lastSignal, + WCOREDUMP(status) ? " (core dumped)" : ""); SaveCore(tb, tp); } tb->lastAnyExit = FT_ApproxTime(); diff --git a/src/util/assert.c b/src/util/assert.c index ca35cc2f41..b144466216 100644 --- a/src/util/assert.c +++ b/src/util/assert.c @@ -26,7 +26,14 @@ void afs_NTAbort(void) void AssertionFailed(char *file, int line) { - fprintf(stderr, "Assertion failed! file %s, line %d.\n", file, line); + char tdate[26]; + time_t when; + + time(&when); + strcpy(tdate, ctime(&when)); + tdate[24] = '0'; + fprintf(stderr, "%s: Assertion failed! file %s, line %d.\n", + tdate, file, line); fflush(stderr); #ifdef AFS_NT40_ENV afs_NTAbort();