mirror of
https://github.com/php/presentations.git
synced 2026-03-24 07:32:11 +01:00
25 lines
673 B
XML
25 lines
673 B
XML
<slide title="Syslog Cont.">
|
|
|
|
<blurb fontsize="4em">
|
|
%syslog()% sends error messages to the system's central error tracking facility.
|
|
The system's logging mechanism supports many features including e-mail notification.
|
|
</blurb>
|
|
|
|
<example><![CDATA[<?php
|
|
// initialize syslog constants
|
|
define_syslog_variables();
|
|
|
|
/* open system log file.
|
|
* The LOG_ODELAY indicated that that logging facility
|
|
* should not be opened until an actual error occurs.
|
|
*/
|
|
openlog("PHP Error", LOG_ODELAY, LOG_USER);
|
|
|
|
if (!input_validation()) {
|
|
syslog(LOG_ALERT, "H4x0r detected at {$_SERVER['REMOTE_ADDR']} {$_SERVER['HTTP_USER_AGENT']}");
|
|
}
|
|
|
|
closelog(); // close log
|
|
?>]]></example>
|
|
|
|
</slide> |