comparison src/http/modules/ngx_http_log_module.c @ 5927:ac2a8e4d8f01

Access log: restricted "log_format" to "http" level. Specifying the "log_format" directive on levels other than "http" is deprecated since 73d37e1ccb91 (1.1.11).
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 01 Dec 2014 14:51:36 +0300
parents dff86e2246a5
children b3682580c1bd
comparison
equal deleted inserted replaced
5926:08bfc7188a41 5927:ac2a8e4d8f01
150 150
151 151
152 static ngx_command_t ngx_http_log_commands[] = { 152 static ngx_command_t ngx_http_log_commands[] = {
153 153
154 { ngx_string("log_format"), 154 { ngx_string("log_format"),
155 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_2MORE, 155 NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
156 ngx_http_log_set_format, 156 ngx_http_log_set_format,
157 NGX_HTTP_MAIN_CONF_OFFSET, 157 NGX_HTTP_MAIN_CONF_OFFSET,
158 0, 158 0,
159 NULL }, 159 NULL },
160 160
1446 1446
1447 ngx_str_t *value; 1447 ngx_str_t *value;
1448 ngx_uint_t i; 1448 ngx_uint_t i;
1449 ngx_http_log_fmt_t *fmt; 1449 ngx_http_log_fmt_t *fmt;
1450 1450
1451 if (cf->cmd_type != NGX_HTTP_MAIN_CONF) {
1452 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1453 "the \"log_format\" directive may be used "
1454 "only on \"http\" level");
1455 }
1456
1457 value = cf->args->elts; 1451 value = cf->args->elts;
1458 1452
1459 fmt = lmcf->formats.elts; 1453 fmt = lmcf->formats.elts;
1460 for (i = 0; i < lmcf->formats.nelts; i++) { 1454 for (i = 0; i < lmcf->formats.nelts; i++) {
1461 if (fmt[i].name.len == value[1].len 1455 if (fmt[i].name.len == value[1].len