$server_name in error_log logfile name

Maxim Dounin mdounin at mdounin.ru
Fri Sep 23 11:19:09 UTC 2011


On Fri, Sep 23, 2011 at 06:52:50AM -0400, Hety wrote:

> Why its supports it in access_log then? I fail to see logic here.

Access log is quite different as it's only needed/used during 
http request processing.  On the other hand, error_log is global thing 
and used even if no http requests exists, e.g. to log signals and 
various other internal actions.  It's not possible to use 
variables which are only exists in http request context to log 
internal actions.

And again (this tends to be a FAQ):

You shouldn't use variables to shorten configs by storing static 
strings in them.  Variables are evaluated at run-time during 
request process, they are costly compared to static strings.  You 
need some macro expansion instead.  Right now it may be done via 
external tools, e.g. sed + make will do (as well as any other 
template mechanism).

Maxim Dounin

More information about the nginx mailing list