[nginx] svn commit: r4328 - trunk/src/http/modules

Joshua Zhu zhuzhaoyuan at gmail.com
Tue May 15 16:14:52 UTC 2012


Hi,

On Wed, May 16, 2012 at 12:06 AM, Ruslan Ermilov <ru at nginx.com> wrote:

> On Tue, May 15, 2012 at 12:56:17PM +0800, Joshua Zhu wrote:
> > Hi Ruslan,
> >
> > On Wed, Dec 7, 2011 at 5:07 AM, <ru at nginx.com> wrote:
> >
> > > Author: ru
> > > Date: 2011-12-06 21:07:10 +0000 (Tue, 06 Dec 2011)
> > > New Revision: 4328
> > >
> > > Log:
> > > - Improved error message when parsing of the "buffer" parameter of the
> > >  "access_log" directive fails.
> > >
> > > - Added a warning if "log_format" is used in contexts other than
> "http".
> > >
> > >
> > > Modified:
> > >   trunk/src/http/modules/ngx_http_log_module.c
> > >
> > > Modified: trunk/src/http/modules/ngx_http_log_module.c
> > > ===================================================================
> > > --- trunk/src/http/modules/ngx_http_log_module.c        2011-12-06
> > > 15:49:40 UTC (rev 4327)
> > > +++ trunk/src/http/modules/ngx_http_log_module.c        2011-12-06
> > > 21:07:10 UTC (rev 4328)
> > > @@ -971,7 +971,7 @@
> > >
> > >         if (buf == NGX_ERROR) {
> > >             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
> > > -                               "invalid parameter \"%V\"", &value[3]);
> > > +                               "invalid buffer value \"%V\"", &name);
> > >             return NGX_CONF_ERROR;
> > >         }
> > >
> > > @@ -1004,6 +1004,12 @@
> > >     ngx_uint_t           i;
> > >     ngx_http_log_fmt_t  *fmt;
> > >
> > > +    if (cf->cmd_type != NGX_HTTP_MAIN_CONF) {
> > > +        ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
> > > +                           "the \"log_format\" directive may be used "
> > > +                           "only on \"http\" level");
> > > +    }
> > > +
> > >     value = cf->args->elts;
> > >
> > >     fmt = lmcf->formats.elts;
> > >
> >
> > 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.
> >
> > 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.
>
> 1.  "log_format" was never documented to be supported on levels
>    other than "http".
>
> 2.  Surprisingly, "log_format" specified in one "location" makes it
>    magically available anywhere below in the configuration, including
>    other locations and other servers.
>
> 3.  The commit you reference didn't change or prohibit anything, but
>    made nginx emit a warning if you try to use "log_format" on levels
>    other than "http", due to above mentioned side effects.
>
> After a commit, Maxim Dounin suggested to officially support "log_format"
> on levels other than "http" but it was never implemented.


Now I see. Thank you for your kind explanation.

Regards,

-- 
Joshua Zhu
Senior Software Engineer
Server Platforms Team at Taobao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120516/89884850/attachment.html>


More information about the nginx-devel mailing list