]> git.kaiwu.me - nginx.git/commitdiff
Core: moved initialization of log level.
authorVladimir Homutov <vl@nginx.com>
Thu, 13 Jun 2013 10:50:10 +0000 (14:50 +0400)
committerVladimir Homutov <vl@nginx.com>
Thu, 13 Jun 2013 10:50:10 +0000 (14:50 +0400)
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().

src/core/ngx_cycle.c
src/core/ngx_log.c

index de817750c31c945de2a0c81387bb8d5502ffde2a..44edbafd450ccee557ee60f549d9f60b088a39ad 100644 (file)
@@ -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 */
index 20f50971db8de77aec1886a6e5f63e372455803e..ea08ba744df3bceb1a643f9ad9fc7ef92bd1ecd9 100644 (file)
@@ -454,7 +454,5 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
         return NGX_CONF_OK;
     }
 
-    cf->cycle->new_log.log_level = 0;
-
     return ngx_log_set_levels(cf, &cf->cycle->new_log);
 }