closelog

Close connection to system logger

Syntax

closelog(): bool

Return

Returns TRUE on success or FALSE on failure.

Examples

<?

// open syslog, include the process ID and send the log to standard error, and use a user defined logging mechanism

$prefix = "myScriptLog";
$flags = LOG_PID | LOG_PERROR;
$facility = LOG_LOCAL0;

openlog($prefix, $flags, $facility);

    if(authorized_client())
    {
        // do something
    }
    else
    {
        // unauthorized client, log attempt
        $access = date("Y/m/d H:i:s");
        $priority = LOG_WARNING;
        $message = "unauthorized client: $access {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})";
        syslog($priority, $message);
    }

closelog();

?>

			
		

Internal

openlog

syslog

External

PHP

Home Menu