2015-02-07 53 views
2

我無法弄清楚如何在php-fpm中禁止通知級別的日誌事件,如下所示:PHP-FPM如何抑制通知日誌級別並仍然捕獲警告日誌/etc/php-fpm.conf

[07-Feb-2015 10:06:48] NOTICE: [pool www] child 19591 exited with code 0 after 52040.698062 seconds from start 
[07-Feb-2015 10:06:49] NOTICE: [pool www] child 17234 started 
[07-Feb-2015 10:06:50] NOTICE: [pool www] child 19822 exited with code 0 after 52014.845635 seconds from start 
[07-Feb-2015 10:06:50] NOTICE: [pool www] child 17261 started 
[07-Feb-2015 10:07:33] NOTICE: [pool www] child 17784 exited with code 0 after 52246.014015 seconds from start 

雖然仍然捕獲類型警告的日誌事件,例如將由php中的error_log()函數創建。記錄事件如以下:

[07-Feb-2015 11:46:44] WARNING: [pool www] child 32465 said into stderr: "NOTICE: PHP message: Array" 
[07-Feb-2015 11:46:44] WARNING: [pool www] child 32465 said into stderr: "(" 
[07-Feb-2015 11:46:44] WARNING: [pool www] child 32465 said into stderr: "  [6] => 363" 
[07-Feb-2015 11:46:44] WARNING: [pool www] child 32465 said into stderr: ")" 
[07-Feb-2015 11:46:44] WARNING: [pool www] child 32465 said into stderr: "" 

從php.net它指出可變LOG_LEVEL accecpts以下字符串類型來調整記錄的捕獲的水平:

錯誤日誌級別。可能的值:警報,錯誤,警告,注意,調試。默認值:通知。

http://php.net/manual/en/install.fpm.configuration.php

於是,自然而然地在我的/etc/php-fpm.conf文件我設置的配置值: LOG_LEVEL:預警和服務重新啓動。然後我得到上述的無日誌事件。

我找不到任何文檔指出每個log_level選項所做的事情,而且似乎除了通知之外的任何東西都會壓制所有內容。

這是在centOS機器上使用php-fpm 5.4或5.5。

回答

0

我有同樣的問題。我通過在相應的php.ini中更改error_reporting來擺脫通知。

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE 

這意味着:報告所有錯誤,但棄用,嚴格和通知類型。

日誌級別似乎是錯誤的地方進行調整。