aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2014-12-02 05:54:54 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2014-12-02 05:54:54 +0300
commit10345663c8d7d011ae186fb22d5fdf9a1912b80d (patch)
treea50705318cf3dffcf9cd703e7e3f9898e22f8326 /src/http/ngx_http_upstream.c
parent778cc4b42ea85e19a8ebf6c1a42fc636e48ec309 (diff)
downloadnginx-10345663c8d7d011ae186fb22d5fdf9a1912b80d.tar.gz
nginx-10345663c8d7d011ae186fb22d5fdf9a1912b80d.zip
Upstream: improved subrequest logging.
To ensure proper logging make sure to set current_request in all event handlers, including resolve, ssl handshake, cache lock wait timer and aio read handlers. A macro ngx_http_set_log_request() introduced to simplify this.
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r--src/http/ngx_http_upstream.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 3d267bda9..4c768b1bc 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -942,6 +942,11 @@ ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
u = r->upstream;
ur = u->resolved;
+ ngx_http_set_log_request(c->log, r);
+
+ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
+ "http upstream resolve: \"%V?%V\"", &r->uri, &r->args);
+
if (ctx->state) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"%V could not be resolved (%i: %s)",
@@ -1003,7 +1008,6 @@ ngx_http_upstream_handler(ngx_event_t *ev)
{
ngx_connection_t *c;
ngx_http_request_t *r;
- ngx_http_log_ctx_t *ctx;
ngx_http_upstream_t *u;
c = ev->data;
@@ -1012,8 +1016,7 @@ ngx_http_upstream_handler(ngx_event_t *ev)
u = r->upstream;
c = r->connection;
- ctx = c->log->data;
- ctx->current_request = r;
+ ngx_http_set_log_request(c->log, r);
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http upstream request: \"%V?%V\"", &r->uri, &r->args);
@@ -1447,6 +1450,8 @@ ngx_http_upstream_ssl_handshake(ngx_connection_t *c)
r = c->data;
u = r->upstream;
+ ngx_http_set_log_request(c->log, r);
+
if (c->ssl->handshaked) {
if (u->conf->ssl_verify) {