summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPoornima <pgurusid@redhat.com>2014-01-17 02:45:56 +0000
committerAnand Avati <avati@redhat.com>2014-02-12 13:25:47 -0800
commit8eb83e6d9a91c813275f1cbc8e0dc5423fb1ccc0 (patch)
treeb20e40440a6175de36aa402059fdbabeb07e394c
parent2e093c728c856a41399ffdcf33c91d21c3a2f0f2 (diff)
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 <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/6726 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--libglusterfs/src/logging.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index 0058233a7cf..2bd40b2c2d6 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);
}