comparison src/core/ngx_cycle.c @ 5240:d8af1005e886

Core: fixed handling of "stderr" in error_log. If "stderr" was specified in one of the "error_log" directives, stderr is not redirected to the first error_log on startup, configuration reload, and reopening log files.
author Vladimir Homutov <vl@nginx.com>
date Tue, 04 Jun 2013 11:27:36 +0400
parents 85e72ea8fbfd
children 3bb51e5afa9e
comparison
equal deleted inserted replaced
5239:85e72ea8fbfd 5240:d8af1005e886
580 } 580 }
581 581
582 582
583 /* commit the new cycle configuration */ 583 /* commit the new cycle configuration */
584 584
585 if (!ngx_use_stderr && cycle->log->file->fd != ngx_stderr) { 585 if (!ngx_use_stderr && !cycle->log_use_stderr
586 586 && cycle->log->file->fd != ngx_stderr)
587 {
587 if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) { 588 if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
588 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 589 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
589 ngx_set_stderr_n " failed"); 590 ngx_set_stderr_n " failed");
590 } 591 }
591 } 592 }
1226 } 1227 }
1227 1228
1228 file[i].fd = fd; 1229 file[i].fd = fd;
1229 } 1230 }
1230 1231
1231 if (cycle->log->file->fd != ngx_stderr) { 1232 if (!cycle->log_use_stderr && cycle->log->file->fd != ngx_stderr) {
1232 1233
1233 if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) { 1234 if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
1234 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 1235 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
1235 ngx_set_stderr_n " failed"); 1236 ngx_set_stderr_n " failed");
1236 } 1237 }