Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 5254:7ecaa9e4bf1b
Core: support several "error_log" directives.
When several "error_log" directives are specified in the same configuration
block, logs are written to all files with a matching log level.
All logs are stored in the singly-linked list that is sorted by log level in
the descending order.
Specific debug levels (NGX_LOG_DEBUG_HTTP,EVENT, etc.) are not supported
if several "error_log" directives are specified. In this case all logs
will use debug level that has largest absolute value.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 20 Jun 2013 20:47:39 +0400 |
parents | d8af1005e886 |
children | 05ba5bce31e0 |
comparison
equal
deleted
inserted
replaced
5253:a82f305487c2 | 5254:7ecaa9e4bf1b |
---|---|
4886 static char * | 4886 static char * |
4887 ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 4887 ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4888 { | 4888 { |
4889 ngx_http_core_loc_conf_t *clcf = conf; | 4889 ngx_http_core_loc_conf_t *clcf = conf; |
4890 | 4890 |
4891 ngx_str_t *value, name; | 4891 return ngx_log_set_log(cf, &clcf->error_log); |
4892 | |
4893 if (clcf->error_log) { | |
4894 return "is duplicate"; | |
4895 } | |
4896 | |
4897 value = cf->args->elts; | |
4898 | |
4899 if (ngx_strcmp(value[1].data, "stderr") == 0) { | |
4900 ngx_str_null(&name); | |
4901 cf->cycle->log_use_stderr = 1; | |
4902 | |
4903 } else { | |
4904 name = value[1]; | |
4905 } | |
4906 | |
4907 clcf->error_log = ngx_log_create(cf->cycle, &name); | |
4908 if (clcf->error_log == NULL) { | |
4909 return NGX_CONF_ERROR; | |
4910 } | |
4911 | |
4912 if (cf->args->nelts == 2) { | |
4913 clcf->error_log->log_level = NGX_LOG_ERR; | |
4914 return NGX_CONF_OK; | |
4915 } | |
4916 | |
4917 return ngx_log_set_levels(cf, clcf->error_log); | |
4918 } | 4892 } |
4919 | 4893 |
4920 | 4894 |
4921 static char * | 4895 static char * |
4922 ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 4896 ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |