"Log errors to the system log"
In php.ini, set Error_log to:
Error_log = syslog
Or, use the Ini_set () function setting at run time.
"Example 1"
<?PHP//Turn off error displayIni_set(' Display_errors ', 0);//turn on the error log functionIni_set(' Log_errors ', ' on ');//setting the path to the error logIni_set(' Error_log ', ' syslog ');//Show All Errorserror_reporting(-1);//Error logging error//notification levelEcho $test; //WarningSettype($var, ' Dee ');//Fatal errorTest ();
To view the error log (Windows system):
My Computer----Right-click-----Manage-----Event Viewer-----Information
"Example 2" sends the system log via Openlog ()
<?PHP//Turn off error displayIni_set(' Display_errors ', 0);//turn on the error log functionIni_set(' Log_errors ', ' on ');//setting the path to the error logIni_set(' Error_log ', ' syslog ');//Show All Errorserror_reporting(-1);//Open the connection to the system logOpenlog(' PHP5.3.10 ', Log_pid, Log_syslog);//Openlog:open connection to System logger//send logssyslog(Log_err, ' This is a test of a syslog '.Date("Y-m-d h:i:s"));//shut down the system log connectionCloselog();
You can also see the log in the Event Viewer warning message:
PHP errors and exceptions notes and summaries (6) to save the error log in the system log