If the file isn't closed such as when logging to stdout or stderr the file must be...
[collectd.git] / src / logfile.c
index 6d0f6e0..e063dd0 100644 (file)
@@ -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);