Klaus Demo nginx / 3a58cc9
fix "access_log off" Igor Sysoev 15 years ago
1 changed file(s) with 34 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
154154 };
155155
156156
157 static ngx_str_t http_access_log = ngx_string(NGX_HTTP_LOG_PATH);
157 static ngx_str_t ngx_http_access_log = ngx_string(NGX_HTTP_LOG_PATH);
158158
159159
160160 static ngx_str_t ngx_http_combined_fmt =
553553 ngx_http_log_fmt_t *fmt;
554554 ngx_http_log_main_conf_t *lmcf;
555555
556 if (conf->logs || conf->off) {
557 return NGX_CONF_OK;
558 }
559
560 *conf = *prev;
561
562 if (conf->logs || conf->off) {
563 return NGX_CONF_OK;
564 }
565
566 conf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
556567 if (conf->logs == NULL) {
557
558 if (conf->off) {
559 return NGX_CONF_OK;
560 }
561
562 if (prev->logs) {
563 conf->logs = prev->logs;
564
565 } else {
566
567 if (prev->off) {
568 conf->off = prev->off;
569 return NGX_CONF_OK;
570 }
571
572 conf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
573 if (conf->logs == NULL) {
574 return NGX_CONF_ERROR;
575 }
576
577 log = ngx_array_push(conf->logs);
578 if (log == NULL) {
579 return NGX_CONF_ERROR;
580 }
581
582 log->file = ngx_conf_open_file(cf->cycle, &http_access_log);
583 if (log->file == NULL) {
584 return NGX_CONF_ERROR;
585 }
586
587 log->disk_full_time = 0;
588 log->error_log_time = 0;
589
590 lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
591 fmt = lmcf->formats.elts;
592
593 /* the default "combined" format */
594 log->ops = fmt[0].ops;
595 lmcf->combined_used = 1;
596 }
597 }
568 return NGX_CONF_ERROR;
569 }
570
571 log = ngx_array_push(conf->logs);
572 if (log == NULL) {
573 return NGX_CONF_ERROR;
574 }
575
576 log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
577 if (log->file == NULL) {
578 return NGX_CONF_ERROR;
579 }
580
581 log->disk_full_time = 0;
582 log->error_log_time = 0;
583
584 lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
585 fmt = lmcf->formats.elts;
586
587 /* the default "combined" format */
588 log->ops = fmt[0].ops;
589 lmcf->combined_used = 1;
598590
599591 return NGX_CONF_OK;
600592 }