Disable buffering of the stderr

There are some 3d party libs that are used by clickhouse that uses
stderr, for example rdkafka, and buffering of rdkafka logs may be a
problem in tests at least.
This commit is contained in:
Azat Khuzhin 2020-05-04 17:57:09 +03:00
parent 3a0b77132d
commit ed4c7820be

View File

@ -547,6 +547,9 @@ void BaseDaemon::initialize(Application & self)
std::string stderr_path = config().getString("logger.stderr", log_path + "/stderr.log");
if (!freopen(stderr_path.c_str(), "a+", stderr))
throw Poco::OpenFileException("Cannot attach stderr to " + stderr_path);
/// Disable buffering for stderr
setbuf(stderr, nullptr);
}
if ((!log_path.empty() && is_daemon) || config().has("logger.stdout"))