Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream.c @ 5928:8dfee01ff0bd
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 02 Dec 2014 05:54:54 +0300 |
parents | 88d55e5934f7 |
children | 1573fc7875fa |
comparison
equal
deleted
inserted
replaced
5927:ac2a8e4d8f01 | 5928:8dfee01ff0bd |
---|---|
940 c = r->connection; | 940 c = r->connection; |
941 | 941 |
942 u = r->upstream; | 942 u = r->upstream; |
943 ur = u->resolved; | 943 ur = u->resolved; |
944 | 944 |
945 ngx_http_set_log_request(c->log, r); | |
946 | |
947 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
948 "http upstream resolve: \"%V?%V\"", &r->uri, &r->args); | |
949 | |
945 if (ctx->state) { | 950 if (ctx->state) { |
946 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 951 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
947 "%V could not be resolved (%i: %s)", | 952 "%V could not be resolved (%i: %s)", |
948 &ctx->name, ctx->state, | 953 &ctx->name, ctx->state, |
949 ngx_resolver_strerror(ctx->state)); | 954 ngx_resolver_strerror(ctx->state)); |
1001 static void | 1006 static void |
1002 ngx_http_upstream_handler(ngx_event_t *ev) | 1007 ngx_http_upstream_handler(ngx_event_t *ev) |
1003 { | 1008 { |
1004 ngx_connection_t *c; | 1009 ngx_connection_t *c; |
1005 ngx_http_request_t *r; | 1010 ngx_http_request_t *r; |
1006 ngx_http_log_ctx_t *ctx; | |
1007 ngx_http_upstream_t *u; | 1011 ngx_http_upstream_t *u; |
1008 | 1012 |
1009 c = ev->data; | 1013 c = ev->data; |
1010 r = c->data; | 1014 r = c->data; |
1011 | 1015 |
1012 u = r->upstream; | 1016 u = r->upstream; |
1013 c = r->connection; | 1017 c = r->connection; |
1014 | 1018 |
1015 ctx = c->log->data; | 1019 ngx_http_set_log_request(c->log, r); |
1016 ctx->current_request = r; | |
1017 | 1020 |
1018 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | 1021 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
1019 "http upstream request: \"%V?%V\"", &r->uri, &r->args); | 1022 "http upstream request: \"%V?%V\"", &r->uri, &r->args); |
1020 | 1023 |
1021 if (ev->write) { | 1024 if (ev->write) { |
1444 ngx_http_request_t *r; | 1447 ngx_http_request_t *r; |
1445 ngx_http_upstream_t *u; | 1448 ngx_http_upstream_t *u; |
1446 | 1449 |
1447 r = c->data; | 1450 r = c->data; |
1448 u = r->upstream; | 1451 u = r->upstream; |
1452 | |
1453 ngx_http_set_log_request(c->log, r); | |
1449 | 1454 |
1450 if (c->ssl->handshaked) { | 1455 if (c->ssl->handshaked) { |
1451 | 1456 |
1452 if (u->conf->ssl_verify) { | 1457 if (u->conf->ssl_verify) { |
1453 rc = SSL_get_verify_result(c->ssl->connection); | 1458 rc = SSL_get_verify_result(c->ssl->connection); |