]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: display exec path on first warning
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 28 May 2021 07:57:10 +0000 (09:57 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 7 Jun 2021 15:19:15 +0000 (17:19 +0200)
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.

src/errors.c

index 81c893445d30fb29ddaf7fedca7e7f3dde92b470..88534ae384f68cf150f3eec08d971a158e4841c2 100644 (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);