我有Apache 2.4和PHP 5.6作爲模塊。 有沒有辦法將自定義錯誤發送到當前'ErrorLog'文件? 'ErrorLog'指令取決於時間(每日日誌)。 我有非常具體的要求:Apache + mod_php如何手動記錄錯誤?
- 我不能調用
trigger_error
功能(錯誤信息不應顯示,僅記錄); - 我不能使用
display_errors
與none
值 - 我不能使用@運算符
任何變種?
我有Apache 2.4和PHP 5.6作爲模塊。 有沒有辦法將自定義錯誤發送到當前'ErrorLog'文件? 'ErrorLog'指令取決於時間(每日日誌)。 我有非常具體的要求:Apache + mod_php如何手動記錄錯誤?
trigger_error
功能(錯誤信息不應顯示,僅記錄);display_errors
與none
值任何變種?
任何語言都會讓你寫信給stderr。 stderr被重定向到基本服務器ErrorLog。試試fprintf。
'$ err = error_get_last();的第二個要求。 $ msg = $ err ['message']; $ stderr = fopen('php:// stderr','w'); fprintf($ stderr,「%s」,$ msg); fclose($ stderr);'沒有工作 – SLY
http://php.net/manual/en/function.error-log.php – MonkeyZeus
http://stackoverflow.com/questions/15530039/how-to-write-to-error-log-file-in -php – MonkeyZeus
我不知道日誌文件名,它不是靜態的。更多的是在本地,測試和生產服務器上的不同文件。 – SLY