Menu Home

closelog

osbo.com | PHP | Functions | closelog

Close connection to system logger

Syntax

closelog ( void ) : 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

$ident = "myScriptLog";
$option = LOG_PID | LOG_PERROR;
$facility = LOG_LOCAL0;

openlog($ident, $option, $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