From: Nathan Huff Date: Thu, 24 Jan 2013 16:10:02 +0000 (-0600) Subject: If the file isn't closed such as when logging to stdout or stderr the file must be... X-Git-Tag: collectd-4.10.9~18 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=57c885581078b06c0641307a60ff97be3ebec90b;p=collectd.git If the file isn't closed such as when logging to stdout or stderr the file must be flushed for it to get out of the IO buffers right away. Signed-off-by: Florian Forster --- diff --git a/src/logfile.c b/src/logfile.c index 6d0f6e07..e063dd08 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -164,8 +164,11 @@ static void logfile_print (const char *msg, int severity, time_t timestamp_time) else fprintf (fh, "%s%s\n", level_str, msg); - if (do_close != 0) + if (do_close != 0) { fclose (fh); + } else { + fflush(fh); + } } pthread_mutex_unlock (&file_lock);