【发布时间】:2020-09-23 14:18:45
【问题描述】:
我希望我的消息直接出现在我的 NginX 错误日志中,例如
2020/06/04 16:23:00 [error] 9057#9057: *26 FastCGI sent in stderr: "MESSAGE" while reading response header from upstream, client: 151.24.155.27, server: "fqdn", request: "GET /page.php HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "hostname"
我知道 PHP 在通过 CLI 执行时可以写入 STDERR,但我指的是网页。
【问题讨论】:
-
不能用error_log函数吗?例如:
error_log("This is my message", 0); -
@WayneWhitty 是的,我刚刚尝试过,它有效,您可以发布像我这样的答案,以便我选择您的。
-
您可以选择自己的答案!
-
我的答案是最新的,所以我删除它以避免重复。