PHP erroru log to syslog to a custom file pipe来跟踪错误。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP erroru log to syslog to a custom file pipe来跟踪错误。相关的知识,希望对你有一定的参考价值。
So i wanted to spit all my error_log(); and error_reporting(E_ALL); to syslog on my MacOSX and syslog would output it on a custom file.
use this line so all your errors are logged. <?php ?> go to your php.ini and set the following: error_log = syslog go to your apache.conf (httpd.conf) and set the following: ErrorLog syslog:local3 go to your syslog.conf and set the following at the very end of the file: local3.* /var/log/httpd-php.log then look for a line like this: *.notice;authpriv,remoteauth,ftp,install,internal.none /var/log/system.log and add local3.none *.notice;authpriv,remoteauth,ftp,install,internal.none /var/log/system.log this will make sure httpd php errors won't log to your /var/log/system.log file that's reserved for your machine logs. and you are set when you want to log something, use error_log(); example: error_log("Error: " .$user. " is not authenticated"); and then to view your errors in real time: tail -F /var/log/httpd-php.log you can also color this using "colorize" on OSX/FreeBSD or "ccze" on Linux. enjoy!
以上是关于PHP erroru log to syslog to a custom file pipe来跟踪错误。的主要内容,如果未能解决你的问题,请参考以下文章
Syslog:在我的 PHP 应用程序中使用 syslog 记录错误的配置是啥