PHP Error and Logging functions

Source: Internet
Author: User
Tags error handling exception handling log php error server error log

Introduction to PHP Error and Logging

The error and logging functions allow you to process and record errors.

The error function allows the user to define fault-handling rules and modify the way in which the errors are logged.

The logging function allows users to log applications and send log messages to e-mail, system logs, or other machines.

PHP Error and Logging functions

PHP: Indicates the earliest version of PHP that supports this function.

function Description PHP
Debug_backtrace () Generate BackTrace. 4
Debug_print_backtrace () Output backtrace. 5
Error_get_last () Get the last error that happened. 5
Error_log () Send an error to the server error log, file, or remote destination. 4
Error_reporting () Specify which error to report. 4
Restore_error_handler () Restore the error handler before. 4
Restore_exception_handler () The exception handler before the restore. 5
Set_error_handler () Set user-defined error-handling functions. 4
Set_exception_handler () Sets the user-defined exception handling function. 5
Trigger_error () Create user-customized error messages. 4
User_error () Alias for Trigger_error ().

4

1, Set_error_handler () function

Definitions and usage

The Set_error_handler () function sets the user-defined error-handling function.

This function is used to create the user's own error handling for the Run-time period.

The function returns the old error handler, or null if it fails.

Grammar

Set_error_handler (Error_function,error_types)
Parameters Description
Error_function Necessary. Specify the function to run when an error occurs.
Error_types Optional. Specify which error reporting level will display user-defined errors. The default is "E_all".






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.