From 8eb83e6d9a91c813275f1cbc8e0dc5423fb1ccc0 Mon Sep 17 00:00:00 2001 From: Poornima Date: Fri, 17 Jan 2014 02:45:56 +0000 Subject: gfapi: Set log level to GF_LOG_NONE after closing log file in glfs_fini Currently any logs that are logged after calling glfs_fini will appear on stderr. Ideally to the end of the glfs_fini all the operations will be complete and there should be no further logging. But it appears that the client translator is still up and prints some log messages even after calling glfs_fini. In this patch the log level is set to GF_LOG_NONE once the log file is closed. This fix is not required if wait for "CHILD_DOWN" event is implemented in glfs_fini. Change-Id: Idde80e9a89f3a5264d02b7e6fc2a84d67550b20a BUG: 1054696 Signed-off-by: Poornima Reviewed-on: http://review.gluster.org/6726 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/logging.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/logging.c') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 0058233a7..2bd40b2c2 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -138,6 +138,7 @@ gf_log_fini (void *data) call to gf_log after calling gf_log_fini, will log the message to stderr. */ + ctx->log.loglevel = GF_LOG_NONE; ctx->log.logfile = NULL; } } @@ -556,7 +557,7 @@ _gf_log_nomem (const char *domain, const char *file, { if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); } @@ -711,7 +712,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, { if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); } @@ -880,7 +881,7 @@ log: if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); fflush (ctx->log.logfile); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); fflush (stderr); } -- cgit