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". |