[njs] Improved logging for js_set and js_content directives.

Dmitry Volyntsev xeioex at nginx.com
Mon May 28 14:06:38 UTC 2018


details:   http://hg.nginx.org/njs/rev/b65fa3d62b74
branches:  
changeset: 525:b65fa3d62b74
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon May 28 17:05:17 2018 +0300
description:
Improved logging for js_set and js_content directives.

Previously, unknown functions were reported under the debug log level
which made the debugging of misconfigured directives harder.

diffstat:

 nginx/ngx_http_js_module.c   |  8 ++++----
 nginx/ngx_stream_js_module.c |  4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 481402695c87 -r b65fa3d62b74 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c	Mon May 28 17:05:16 2018 +0300
+++ b/nginx/ngx_http_js_module.c	Mon May 28 17:05:17 2018 +0300
@@ -665,8 +665,8 @@ ngx_http_js_content_event_handler(ngx_ht
 
     func = njs_vm_function(ctx->vm, &name);
     if (func == NULL) {
-        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
-                       "js function \"%V\" not found", &jlcf->content);
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "js function \"%V\" not found", &jlcf->content);
         ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
         return;
     }
@@ -773,8 +773,8 @@ ngx_http_js_variable(ngx_http_request_t 
 
     func = njs_vm_function(ctx->vm, &name);
     if (func == NULL) {
-        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
-                       "js function \"%V\" not found", fname);
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "js function \"%V\" not found", fname);
         v->not_found = 1;
         return NGX_OK;
     }
diff -r 481402695c87 -r b65fa3d62b74 nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c	Mon May 28 17:05:16 2018 +0300
+++ b/nginx/ngx_stream_js_module.c	Mon May 28 17:05:17 2018 +0300
@@ -585,8 +585,8 @@ ngx_stream_js_variable(ngx_stream_sessio
 
     func = njs_vm_function(ctx->vm, &name);
     if (func == NULL) {
-        ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0,
-                       "js function \"%V\" not found", fname);
+        ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
+                      "js function \"%V\" not found", fname);
         v->not_found = 1;
         return NGX_OK;
     }


More information about the nginx-devel mailing list