[PATCH 2 of 2] Added config path when unknown variable error occurs

Safar Safarly hafl at me.com
Wed Feb 8 15:54:07 UTC 2023


# HG changeset patch
# User Safar Safarly <hafl at me.com>
# Date 1675853769 -10800
#      Wed Feb 08 13:56:09 2023 +0300
# Node ID 1396218aa1296ffc9776644534a1541b78a460a0
# Parent  55553146bd984be7e9e3bbfa851c282feda82d93
Added config path when unknown variable error occurs

Previously, when unknown variable occured, error was logged with
ngx_log_error():

    nginx: [emerg] unknown "rate" variable

instead of ngx_conf_log_error():

    nginx: [emerg] unknown "rate" variable in /conf/nginx.conf:27

diff -r 55553146bd98 -r 1396218aa129 src/http/ngx_http_variables.c
--- a/src/http/ngx_http_variables.c	Tue Feb 07 17:24:26 2023 +0300
+++ b/src/http/ngx_http_variables.c	Wed Feb 08 13:56:09 2023 +0300
@@ -2792,8 +2792,8 @@
         }
 
         if (v[i].get_handler == NULL) {
-            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
-                          "unknown \"%V\" variable", &v[i].name);
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                               "unknown \"%V\" variable", &v[i].name);
 
             return NGX_ERROR;
         }
diff -r 55553146bd98 -r 1396218aa129 src/stream/ngx_stream_variables.c
--- a/src/stream/ngx_stream_variables.c	Tue Feb 07 17:24:26 2023 +0300
+++ b/src/stream/ngx_stream_variables.c	Wed Feb 08 13:56:09 2023 +0300
@@ -1277,8 +1277,8 @@
          }
 
         if (v[i].get_handler == NULL) {
-            ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
-                          "unknown \"%V\" variable", &v[i].name);
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                               "unknown \"%V\" variable", &v[i].name);
             return NGX_ERROR;
         }
 


More information about the nginx-devel mailing list