PHP options and Information function library: Error_log

Source: Internet
Author: User
Keywords error.log php option php Chinese function manual information function library
Tags aliyun error error message error.log file function function library html

Error_log

(PHP3, PHP4)

Error_log---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; send the wrong message to somewhere

Syntax: int error_log (string message, int message_type [, String destination [, String extra_headers]])

Description:

Send an error message to the Web server's error record, a TCP port, or a file. The first argument message is the content of an error that will be logged, and the second argument Message_type where to send the message:

Error_log () record type:

0 message to the system recorder in PHP, using the system recording mechanism of the operating system or file, depending on the error_log set value. 1 email message to the parameter destination specified address, only this form will be used to extra_headers, this form uses the same internal function mail (). 2 message sent to PHP to debug the link, only in the remote error set to enable, this option is valid. Parameter destination is used to specify the host name or IP address, port number, that receives the error message. 3 message appended to file destination.

Example:

<?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@mydomain.com");

}

Other ways of Calling Error_log ():

Error_log ("You messed up!", 2, "127.0.0.1:7000");

Error_log ("You messed up!", 2, "loghost");

Error_log ("You messed up!", 3, "/var/tmp/my-errors.log");

?>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.