comparison src/core/ngx_cycle.c @ 2785:d478379e51ac

*) refactor error_log processing: listen socket log might inherit built-in error_log with zero level, and r2447, r2466, r2467 were not enough *) remove bogus "stderr" level *) some functions and fields renames
author Igor Sysoev <igor@sysoev.ru>
date Thu, 30 Apr 2009 13:53:42 +0000
parents 4bd7825fab80
children 44b2081c015a
comparison
equal deleted inserted replaced
2784:c2230102df6f 2785:d478379e51ac
80 return NULL; 80 return NULL;
81 } 81 }
82 82
83 cycle->pool = pool; 83 cycle->pool = pool;
84 cycle->log = log; 84 cycle->log = log;
85 cycle->new_log.log_level = NGX_LOG_ERR;
85 cycle->old_cycle = old_cycle; 86 cycle->old_cycle = old_cycle;
86 87
87 cycle->conf_prefix.len = old_cycle->conf_prefix.len; 88 cycle->conf_prefix.len = old_cycle->conf_prefix.len;
88 cycle->conf_prefix.data = ngx_pstrdup(pool, &old_cycle->conf_prefix); 89 cycle->conf_prefix.data = ngx_pstrdup(pool, &old_cycle->conf_prefix);
89 if (cycle->conf_prefix.data == NULL) { 90 if (cycle->conf_prefix.data == NULL) {
162 != NGX_OK) 163 != NGX_OK)
163 { 164 {
164 ngx_destroy_pool(pool); 165 ngx_destroy_pool(pool);
165 return NULL; 166 return NULL;
166 } 167 }
167
168
169 cycle->new_log = ngx_log_create_errlog(cycle, &error_log);
170 if (cycle->new_log == NULL) {
171 ngx_destroy_pool(pool);
172 return NULL;
173 }
174
175 168
176 n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10; 169 n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;
177 170
178 cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t)); 171 cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
179 if (cycle->listening.elts == NULL) { 172 if (cycle->listening.elts == NULL) {
334 if (ngx_create_pathes(cycle, ccf->user) != NGX_OK) { 327 if (ngx_create_pathes(cycle, ccf->user) != NGX_OK) {
335 goto failed; 328 goto failed;
336 } 329 }
337 330
338 331
332 if (cycle->new_log.file == NULL) {
333 cycle->new_log.file = ngx_conf_open_file(cycle, &error_log);
334 if (cycle->new_log.file == NULL) {
335 goto failed;
336 }
337 }
338
339 /* open the new files */ 339 /* open the new files */
340 340
341 part = &cycle->open_files.part; 341 part = &cycle->open_files.part;
342 file = part->elts; 342 file = part->elts;
343 343
380 goto failed; 380 goto failed;
381 } 381 }
382 #endif 382 #endif
383 } 383 }
384 384
385 cycle->log = cycle->new_log; 385 cycle->log = &cycle->new_log;
386 pool->log = cycle->new_log; 386 pool->log = &cycle->new_log;
387
388 if (cycle->log->log_level == 0) {
389 cycle->log->log_level = NGX_LOG_ERR;
390 }
391 387
392 388
393 /* create shared memory */ 389 /* create shared memory */
394 390
395 part = &cycle->shared_memory.part; 391 part = &cycle->shared_memory.part;