comparison src/http/ngx_http_core_module.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 09cab3f8d92e
children 5eb4e2d2e9fa
comparison
equal deleted inserted replaced
2784:c2230102df6f 2785:d478379e51ac
1290 r->loc_conf = clcf->limit_except_loc_conf; 1290 r->loc_conf = clcf->limit_except_loc_conf;
1291 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1291 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1292 } 1292 }
1293 1293
1294 if (r == r->main) { 1294 if (r == r->main) {
1295 r->connection->log->file = clcf->err_log->file; 1295 r->connection->log->file = clcf->error_log->file;
1296 1296
1297 if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { 1297 if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
1298 r->connection->log->log_level = clcf->err_log->log_level; 1298 r->connection->log->log_level = clcf->error_log->log_level;
1299 } 1299 }
1300 } 1300 }
1301 1301
1302 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) { 1302 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
1303 r->connection->sendfile = 1; 1303 r->connection->sendfile = 1;
2927 * lcf->root = { 0, NULL }; 2927 * lcf->root = { 0, NULL };
2928 * lcf->limit_except = 0; 2928 * lcf->limit_except = 0;
2929 * lcf->post_action = { 0, NULL }; 2929 * lcf->post_action = { 0, NULL };
2930 * lcf->types = NULL; 2930 * lcf->types = NULL;
2931 * lcf->default_type = { 0, NULL }; 2931 * lcf->default_type = { 0, NULL };
2932 * lcf->err_log = NULL; 2932 * lcf->error_log = NULL;
2933 * lcf->error_pages = NULL; 2933 * lcf->error_pages = NULL;
2934 * lcf->try_files = NULL; 2934 * lcf->try_files = NULL;
2935 * lcf->client_body_path = NULL; 2935 * lcf->client_body_path = NULL;
2936 * lcf->regex = NULL; 2936 * lcf->regex = NULL;
2937 * lcf->exact_match = 0; 2937 * lcf->exact_match = 0;
3107 { 3107 {
3108 return NGX_CONF_ERROR; 3108 return NGX_CONF_ERROR;
3109 } 3109 }
3110 } 3110 }
3111 3111
3112 if (conf->err_log == NULL) { 3112 if (conf->error_log == NULL) {
3113 if (prev->err_log) { 3113 if (prev->error_log) {
3114 conf->err_log = prev->err_log; 3114 conf->error_log = prev->error_log;
3115 } else { 3115 } else {
3116 conf->err_log = cf->cycle->new_log; 3116 conf->error_log = &cf->cycle->new_log;
3117 } 3117 }
3118 } 3118 }
3119 3119
3120 if (conf->error_pages == NULL && prev->error_pages) { 3120 if (conf->error_pages == NULL && prev->error_pages) {
3121 conf->error_pages = prev->error_pages; 3121 conf->error_pages = prev->error_pages;
4102 { 4102 {
4103 ngx_http_core_loc_conf_t *lcf = conf; 4103 ngx_http_core_loc_conf_t *lcf = conf;
4104 4104
4105 ngx_str_t *value; 4105 ngx_str_t *value;
4106 4106
4107 if (lcf->error_log) {
4108 return "is duplicate";
4109 }
4110
4107 value = cf->args->elts; 4111 value = cf->args->elts;
4108 4112
4109 lcf->err_log = ngx_log_create_errlog(cf->cycle, &value[1]); 4113 lcf->error_log = ngx_log_create(cf->cycle, &value[1]);
4110 if (lcf->err_log == NULL) { 4114 if (lcf->error_log == NULL) {
4111 return NGX_CONF_ERROR; 4115 return NGX_CONF_ERROR;
4112 } 4116 }
4113 4117
4114 return ngx_set_error_log_levels(cf, lcf->err_log); 4118 if (cf->args->nelts == 2) {
4119 lcf->error_log->log_level = NGX_LOG_ERR;
4120 return NGX_CONF_OK;
4121 }
4122
4123 return ngx_log_set_levels(cf, lcf->error_log);
4115 } 4124 }
4116 4125
4117 4126
4118 static char * 4127 static char *
4119 ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 4128 ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)