diff options
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/ngx_http.c | 2 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.c | 29 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.h | 2 | ||||
-rw-r--r-- | src/http/ngx_http_request.c | 8 |
4 files changed, 25 insertions, 16 deletions
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c index 5cd0ee1f8..5e487e75c 100644 --- a/src/http/ngx_http.c +++ b/src/http/ngx_http.c @@ -1746,7 +1746,7 @@ ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr) clcf = cscf->ctx->loc_conf[ngx_http_core_module.ctx_index]; - ls->log = *clcf->err_log; + ls->logp = clcf->error_log; ls->log.data = &ls->addr_text; ls->log.handler = ngx_accept_log_error; diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 825c8395c..4b300dfd5 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1292,10 +1292,10 @@ ngx_http_update_location_config(ngx_http_request_t *r) } if (r == r->main) { - r->connection->log->file = clcf->err_log->file; + r->connection->log->file = clcf->error_log->file; if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { - r->connection->log->log_level = clcf->err_log->log_level; + r->connection->log->log_level = clcf->error_log->log_level; } } @@ -2929,7 +2929,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf) * lcf->post_action = { 0, NULL }; * lcf->types = NULL; * lcf->default_type = { 0, NULL }; - * lcf->err_log = NULL; + * lcf->error_log = NULL; * lcf->error_pages = NULL; * lcf->try_files = NULL; * lcf->client_body_path = NULL; @@ -3109,11 +3109,11 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) } } - if (conf->err_log == NULL) { - if (prev->err_log) { - conf->err_log = prev->err_log; + if (conf->error_log == NULL) { + if (prev->error_log) { + conf->error_log = prev->error_log; } else { - conf->err_log = cf->cycle->new_log; + conf->error_log = &cf->cycle->new_log; } } @@ -4104,14 +4104,23 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_str_t *value; + if (lcf->error_log) { + return "is duplicate"; + } + value = cf->args->elts; - lcf->err_log = ngx_log_create_errlog(cf->cycle, &value[1]); - if (lcf->err_log == NULL) { + lcf->error_log = ngx_log_create(cf->cycle, &value[1]); + if (lcf->error_log == NULL) { return NGX_CONF_ERROR; } - return ngx_set_error_log_levels(cf, lcf->err_log); + if (cf->args->nelts == 2) { + lcf->error_log->log_level = NGX_LOG_ERR; + return NGX_CONF_OK; + } + + return ngx_log_set_levels(cf, lcf->error_log); } diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index 546ebbb56..2c4e45acd 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -377,7 +377,7 @@ struct ngx_http_core_loc_conf_s { ngx_flag_t open_file_cache_errors; ngx_flag_t open_file_cache_events; - ngx_log_t *err_log; + ngx_log_t *error_log; ngx_uint_t types_hash_max_size; ngx_uint_t types_hash_bucket_size; diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index d06c6dd3f..9cdd92ddd 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -420,9 +420,9 @@ ngx_http_init_request(ngx_event_t *rev) #endif clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - c->log->file = clcf->err_log->file; + c->log->file = clcf->error_log->file; if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { - c->log->log_level = clcf->err_log->log_level; + c->log->log_level = clcf->error_log->log_level; } if (c->buffer == NULL) { @@ -1704,10 +1704,10 @@ found: r->loc_conf = cscf->ctx->loc_conf; clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - r->connection->log->file = clcf->err_log->file; + r->connection->log->file = clcf->error_log->file; if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { - r->connection->log->log_level = clcf->err_log->log_level; + r->connection->log->log_level = clcf->error_log->log_level; } return NGX_OK; |