From b466283c185654fd2fdd2c5154b98b6ff53f8715 Mon Sep 17 00:00:00 2001 From: Max Berger Date: Mon, 13 Jun 2022 17:54:11 +0200 Subject: [PATCH] Flush log output for all log messages with at least info level --- src/vzlogger.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vzlogger.cpp b/src/vzlogger.cpp index 2bd5759e..d9af1322 100644 --- a/src/vzlogger.cpp +++ b/src/vzlogger.cpp @@ -180,6 +180,10 @@ void print(log_level_t level, const char *format, const char *id, ...) { fprintf(stream, "%-24s", prefix); vfprintf(stream, format, args); fprintf(stream, "\n"); + if (level <= log_info) { + // required for some targets where stdout is redirected (e.g. docker) + fflush(stream); + } m_log.unlock(); // release mutex } va_end(args);