Hi Ruslan,<br><br><div class="gmail_quote">On Wed, Dec 7, 2011 at 5:07 AM, <span dir="ltr"><<a href="mailto:ru@nginx.com" target="_blank">ru@nginx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ru<br>
Date: 2011-12-06 21:07:10 +0000 (Tue, 06 Dec 2011)<br>
New Revision: 4328<br>
<br>
Log:<br>
- Improved error message when parsing of the "buffer" parameter of the<br>
"access_log" directive fails.<br>
<br>
- Added a warning if "log_format" is used in contexts other than "http".<br>
<br>
<br>
Modified:<br>
trunk/src/http/modules/ngx_http_log_module.c<br>
<br>
Modified: trunk/src/http/modules/ngx_http_log_module.c<br>
===================================================================<br>
--- trunk/src/http/modules/ngx_http_log_module.c 2011-12-06 15:49:40 UTC (rev 4327)<br>
+++ trunk/src/http/modules/ngx_http_log_module.c 2011-12-06 21:07:10 UTC (rev 4328)<br>
@@ -971,7 +971,7 @@<br>
<br>
if (buf == NGX_ERROR) {<br>
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,<br>
- "invalid parameter \"%V\"", &value[3]);<br>
+ "invalid buffer value \"%V\"", &name);<br>
return NGX_CONF_ERROR;<br>
}<br>
<br>
@@ -1004,6 +1004,12 @@<br>
ngx_uint_t i;<br>
ngx_http_log_fmt_t *fmt;<br>
<br>
+ if (cf->cmd_type != NGX_HTTP_MAIN_CONF) {<br>
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,<br>
+ "the \"log_format\" directive may be used "<br>
+ "only on \"http\" level");<br>
+ }<br>
+<br>
value = cf->args->elts;<br>
<br>
fmt = lmcf->formats.elts;<br></blockquote><div><br>Could you shed light on why the 'log_format' change was introduced? Since it's a little bit confusing to me that the 'log_format' directive is allowed in http/server/location, but on the other hand, it would be warned if it's in a server/location block.<br>
<br>I ask this question because in my situation, I have lots of separate server{} specific configuration files which are included in the main configuration file, and each server may have its own log_format. Specifying 'log_format' in the server{} is quite handy because it keeps the changes only in the included server specific file.<br>
</div></div><br>Regards,<br><br>-- <br>Joshua Zhu<br>Senior Software Engineer<br>Server Platforms Team at Taobao<br>