Jer*_*son 18 php logging php5 php-fpm
我试图找出 PHP 错误在我的设置中的位置。我正在运行 nginx 作为 PHP-FPM 的反向代理,但我没有看到我的应用程序生成的各种E_NOTICE或E_WARNING消息。我知道它们正在发生的唯一原因是响应失败和 NewRelic 捕获堆栈跟踪。
这是日志配置:
配置文件
proxy_intercept_errors on;
fastcgi_intercept_errors on;
Run Code Online (Sandbox Code Playgroud)
配置文件
error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = On
error_log = syslog
Run Code Online (Sandbox Code Playgroud)
php-fpm.conf
[global]
error_log = /var/log/php-fpm/fpm-error.log
[www]
access.log = /var/log/php-fpm/access.log
access.format = "%t \"%m %r%Q%q\" %s %{mili}dms %{kilo}Mkb %C%%"
catch_workers_output = yes
php_flag[display_errors] = on
php_admin_flag[log_errors] = true
Run Code Online (Sandbox Code Playgroud)
配置文件
:syslogtag, contains, "php" /var/log/php-fpm/error.log
Run Code Online (Sandbox Code Playgroud)
我已将 PHP 配置为记录到 syslog,但是 FPM 没有 syslog 功能,因此它记录到文件中。我真的不在乎错误在哪里结束,只是他们最终在某个地方。
关于我如何让它发挥作用的任何线索?
您的 php-fpm.conf 文件未设置为向 syslog 发送错误。有关如何执行此操作的示例,请参见下文。
; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Note: the default prefix is /var
; Default Value: log/php-fpm.log
error_log = syslog
; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
;syslog.facility = daemon
; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm
;syslog.ident = php-fpm
; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
112658 次 |
最近记录: |