summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2020-07-21 20:27:37 +0300
committerValentin Bartenev <vbart@nginx.com>2020-07-21 20:27:37 +0300
commitd86e0a7aec86bf2ed472aec3a69dd17a34329301 (patch)
tree67ae4622b31256453a7f8f9c7458c56562b3fd41
parentf46ef1b121e421eb4b773dd9a3a951bb021b66ff (diff)
downloadunit-d86e0a7aec86bf2ed472aec3a69dd17a34329301.tar.gz
unit-d86e0a7aec86bf2ed472aec3a69dd17a34329301.tar.bz2
PHP: logging in request context when possible.
Diffstat (limited to '')
-rw-r--r--src/nxt_php_sapi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index ab888f57..ee0976ce 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -1277,6 +1277,16 @@ static void
nxt_php_log_message(char *message TSRMLS_DC)
#endif
{
- nxt_unit_log(nxt_php_unit_ctx, NXT_UNIT_LOG_NOTICE,
- "php message: %s", message);
+ nxt_php_run_ctx_t *ctx;
+
+ ctx = SG(server_context);
+
+ if (ctx != NULL) {
+ nxt_unit_req_log(ctx->req, NXT_UNIT_LOG_NOTICE,
+ "php message: %s", message);
+
+ } else {
+ nxt_unit_log(nxt_php_unit_ctx, NXT_UNIT_LOG_NOTICE,
+ "php message: %s", message);
+ }
}