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().
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index de81775..44edbaf 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -84,7 +84,6 @@
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 @@
if (cycle->new_log.file == NULL) {
goto failed;
}
+
+ cycle->new_log.log_level = NGX_LOG_ERR;
}
/* open the new files */
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index 20f5097..ea08ba7 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -454,7 +454,5 @@
return NGX_CONF_OK;
}
- cf->cycle->new_log.log_level = 0;
-
return ngx_log_set_levels(cf, &cf->cycle->new_log);
}