MINOR: log: display exec path on first warning

Display process executable path on first warning if not already done in
ha_warning, as in ha_alert. The output is thus cleaner when ALERT and
WARN messages are mixed, with the executable path always on first
position.
This commit is contained in:
Amaury Denoyelle 2021-05-28 09:57:10 +02:00
parent 816281ff16
commit da3d68111c

View File

@ -240,6 +240,14 @@ void ha_warning(const char *fmt, ...)
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE) ||
!(global.mode & MODE_STARTING)) {
if (!(warned & WARN_EXEC_PATH) && (global.mode & MODE_STARTING)) {
const char *path = get_exec_path();
warned |= WARN_EXEC_PATH;
print_message_args(0, "NOTICE", "haproxy version is %s\n", haproxy_version);
if (path)
print_message_args(0, "NOTICE", "path to executable is %s\n", path);
}
va_start(argp, fmt);
print_message(1, "WARNING", fmt, argp);
va_end(argp);