PHP error log error_log_PHP tutorial

Source: Internet
Author: User
Tags php error log
PHP error log error_log. 1. php friendly logging error logs (stored in different files by date) [php] create log directory $ destinationimember _. to_date (get_gmtime (), Ym); create an error log and save it to the path 1.php friendly log (save it to different files by date)

[Php]

// Create a log Directory

$ Destination = 'imember _ '. to_date (get_gmtime (), "Ym"); // create an error log storage path

If (! Is_dir ("D:/wamp/logs/". $ destination )){

@ Mkdir ("D:/wamp/logs/". $ destination );

@ Chmod ("D:/wamp/logs/". $ destination, 0777 );

}

// Im: records php error logs

Ini_set ("display_errors", 0); // The error message is not displayed on the page.

Error_reporting (E_ALL ^ E_NOTICE); // record the error log level

Ini_set ("log_errors", "On"); // open the error log

Ini_set ("error_log", "D:/wamp/logs /". $ destination. "/". date ('D '). ". log "); // Set the address for saving the error log

2. error_log description:

Error_reporting () sets the PHP error level and returns the current level.

Syntax

Error_reporting (report_level)

If the level parameter is not specified, the current error level is returned. The following items are possible values of level:

Value constant description

1 E_ERROR Fatal run-time errors. Errors that can not be recovered from. Execution of the script is halted

2 E_WARNING Non-fatal run-time errors. Execution of the script is not halted

4 E_PARSE Compile-time parse errors. Parse errors shoshould only be generated by the parser

8 E_NOTICE Run-time notices. The script found something that might be an error, but cocould also happen when running a script normally

16 E_CORE_ERROR Fatal errors at PHP startup. This is like an E_ERROR in the PHP core

32 E_CORE_WARNING Non-fatal errors at PHP startup. This is like an E_WARNING in the PHP core

64 E_COMPILE_ERROR Fatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine www.2cto.com

128 E_COMPILE_WARNING Non-fatal compile-time errors. This is like an E_WARNING generated by the Zend Scripting Engine

256 E_USER_ERROR Fatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error ()

512 E_USER_WARNING Non-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error ()

1024 E_USER_NOTICE User-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error ()

2048 E_STRICT Run-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code

4096 E_RECOVERABLE_ERROR Catchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler ())

8191 E_ALL All errors and warnings, except T level E_STRICT (E_STRICT will be part of E_ALL as of PHP 6.0)

Http://www.bkjia.com/PHPjc/477723.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477723.htmlTechArticle1.php-friendly logging error logs (saved in different files by date) [php] // create log directory $ destination = imember _. to_date (get_gmtime (), Ym); // create an error log storage path...

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.