Syntax of error_log in PHP
bool error_log(string message, int type[, string destination[, string headers]])
Records an error message to the web server’s error log, to an email address, or to a file. The first parameter is the message to log. The type is one of the following:
0 message is sent to the PHP system log; the message is put into the file pointed at by the error_log configuration directive.
1 message is sent to the email address destination. If specified, headers provides optional headers to use when creating
the message (see mail for more information on the optional headers).
3 Appends message to the file destination.
4 message is sent directly to the SAPI logging handler
Example of error_log
<?php
// Send notification through the server log if we can not
// connect to the database.
if (!Ora_Logon($username, $password)) {
error_log("Oracle database not available!", 0);
}
// Notify administrator by email if we run out of FOO
if (!($foo = allocate_new_foo())) {
error_log("Big trouble, we're all out of FOOs!", 1,
"operator@example.com");
}
// another way to call error_log():
error_log("You messed up!", 3, "/var/tmp/my-errors.log");
?>