diff options
author | Vladimir Homutov <vl@nginx.com> | 2013-06-28 17:24:54 +0400 |
---|---|---|
committer | Vladimir Homutov <vl@nginx.com> | 2013-06-28 17:24:54 +0400 |
commit | dd3e13eef01e9f04ac447eaa3a1a76575944fc28 (patch) | |
tree | b8652fc39f002250d6032d486e2cde27cf40a0da /src/core/ngx_cycle.c | |
parent | f41c91511d5435b81f795954d3eb00d38f6acf56 (diff) |
Core: consolidated log-related code.
The stderr redirection code is moved to ngx_log_redirect_stderr().
The opening of the default log code is moved to ngx_log_open_default().
Diffstat (limited to 'src/core/ngx_cycle.c')
-rw-r--r-- | src/core/ngx_cycle.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index 44edbafd4..2c006bcb2 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -36,8 +36,6 @@ ngx_tls_key_t ngx_core_tls_key; static ngx_connection_t dumb; /* STUB */ -static ngx_str_t error_log = ngx_string(NGX_ERROR_LOG_PATH); - ngx_cycle_t * ngx_init_cycle(ngx_cycle_t *old_cycle) @@ -338,13 +336,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) } - if (cycle->new_log.file == NULL) { - cycle->new_log.file = ngx_conf_open_file(cycle, &error_log); - if (cycle->new_log.file == NULL) { - goto failed; - } - - cycle->new_log.log_level = NGX_LOG_ERR; + if (ngx_log_open_default(cycle) != NGX_OK) { + goto failed; } /* open the new files */ @@ -583,13 +576,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) /* commit the new cycle configuration */ - if (!ngx_use_stderr && !cycle->log_use_stderr - && cycle->log->file->fd != ngx_stderr) - { - if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - ngx_set_stderr_n " failed"); - } + if (!ngx_use_stderr) { + (void) ngx_log_redirect_stderr(cycle); } pool->log = cycle->log; @@ -1230,13 +1218,7 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user) file[i].fd = fd; } - if (!cycle->log_use_stderr && cycle->log->file->fd != ngx_stderr) { - - if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - ngx_set_stderr_n " failed"); - } - } + (void) ngx_log_redirect_stderr(cycle); } |