PHPLogphp debugging tracing tool _ PHP Tutorial

Source: Internet
Author: User
Tags drupal
PHPLogphp debugging tracing tool. Principle: 1. in the process of program execution, record the variables you want to trace, the call stack and the parameters of each function call in the corresponding place, and record the information in a certain format to the file. one principle is as follows:

1. in the process of program execution, record the variables you want to track and the parameters of the call stack and each function call,
Record the information to the file in a certain format, with one variable row. for details about the data format, see the code.

2. now we have all the information (including the call stack and parameters) for every variable record. when you access this program through a browser, this program will read and analyze the entire file,
All your debugging information is displayed on the page, and it will be dynamically refreshed by ajax to keep syncing with your debugging.

Draw a picture. it is much clearer.



BackTrace is the call stack information, which is not shown in the figure. it is dynamically refreshed by ajax.


Function:

Next, let's take a few pictures of the local machine:

1. include the file and debug the variable (above is the program, below is the debug output of apache_request_headers)



2. list of call stacks of a function in the drupal system



3. call parameters of a function in the stack




Postscript:


The program basically implements debugging and tracking php variables. It also comes with the call stack and call parameter viewing functions.

Now echo, print_r, var_dump, and other system functions. if not necessary, I have rarely used them for debugging and output. basically I can use this to get what I want.

Especially complex systems like drupal can clearly understand how programs are executed.


Note:

The program is written in php4 and tested on php4.4.8 and 5.2.5. In theory, php4 and php5 are supported.

Linux, window, ie6-7, firefox are also tested, but still do not dare to ensure that in your environment without errors, if there is, please correct.

Please prevent the log file from exceeding 5 MB, and the browser may crash.
Http://www.jb51.net/codes/20851.html

Lifecycle 1. in the process of program execution, record the variables you want to trace, the call stack and the parameters of each function call in the corresponding place, and record the information to the file in a certain format, one...

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.