[nginx] Core: moved initialization of log level.

Homutov Vladimir vl at nginx.com
Thu Jun 13 10:56:42 UTC 2013


details:   http://hg.nginx.org/nginx/rev/3bb51e5afa9e
branches:  
changeset: 5250:3bb51e5afa9e
user:      Vladimir Homutov <vl at nginx.com>
date:      Thu Jun 13 14:50:10 2013 +0400
description:
Core: moved initialization of log level.

The cycle->new_log->log_level should only be initialized by ngx_init_cycle()
if no error logs were found in the configuration.  This move allows to get rid
of extra initialization in ngx_error_log().

diffstat:

 src/core/ngx_cycle.c |  3 ++-
 src/core/ngx_log.c   |  2 --
 2 files changed, 2 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 725fb71ab1a6 -r 3bb51e5afa9e src/core/ngx_cycle.c
--- a/src/core/ngx_cycle.c	Fri Jun 07 13:16:00 2013 -0700
+++ b/src/core/ngx_cycle.c	Thu Jun 13 14:50:10 2013 +0400
@@ -84,7 +84,6 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
 
     cycle->pool = pool;
     cycle->log = log;
-    cycle->new_log.log_level = NGX_LOG_ERR;
     cycle->old_cycle = old_cycle;
 
     cycle->conf_prefix.len = old_cycle->conf_prefix.len;
@@ -344,6 +343,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
         if (cycle->new_log.file == NULL) {
             goto failed;
         }
+
+        cycle->new_log.log_level = NGX_LOG_ERR;
     }
 
     /* open the new files */
diff -r 725fb71ab1a6 -r 3bb51e5afa9e src/core/ngx_log.c
--- a/src/core/ngx_log.c	Fri Jun 07 13:16:00 2013 -0700
+++ b/src/core/ngx_log.c	Thu Jun 13 14:50:10 2013 +0400
@@ -454,7 +454,5 @@ ngx_error_log(ngx_conf_t *cf, ngx_comman
         return NGX_CONF_OK;
     }
 
-    cf->cycle->new_log.log_level = 0;
-
     return ngx_log_set_levels(cf, &cf->cycle->new_log);
 }



More information about the nginx-devel mailing list