Hello! On Wed, Feb 08, 2023 at 06:54:07PM +0300, Safar Safarly via nginx-devel wrote:
> # HG changeset patch > # User Safar Safarly <h...@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; > } > The ngx_http_variables_init_vars() function you are patching is called when the http block is fully parsed, and therefore ngx_conf_log_error() will always point to the end of the http block. This provides no usable information, so ngx_log_error() is used instead. -- Maxim Dounin http://mdounin.ru/ _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel