Home  >  Article  >  Backend Development  >  PHPLog php program debugging and tracking tool_PHP tutorial

PHPLog php program debugging and tracking tool_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:44:47876browse

Principle:

1. During the execution of the program, record the variables you want to track, the call stack and the parameters of each function call in the corresponding places.
Record this information in a certain format. File, one variable per line, please refer to the code for the specific data format, I will not go into details here.

2. Now there is all the information (including call stack and parameters) every time the variable is recorded. When you log in through the browser When accessing this program, this program will read and analyze the entire file,
display all your debugging information on the page, and it will dynamically refresh ajax to keep synchronized with your debugging.

Draw a picture Well, it’s much clearer.

PHPLog php program debugging and tracking tool_PHP tutorial

BackTrace is the call stack information, which is not reflected in the picture. It is dynamically refreshed by ajax.


Function:

Cut again Here are a few local diagrams:

1. Include files, debugging variables (the above is the program, the bottom is the debugging output of apache_request_headers())

PHPLog php program debugging and tracking tool_PHP tutorial

2. Call stack list of a certain function in the drupal system

PHPLog php program debugging and tracking tool_PHP tutorial

3. Call parameters of a function in the stack

PHPLog php program debugging and tracking tool_PHP tutorial



Postscript:


The program basically implements the functions of debugging and tracking PHP variables, and also comes with a call stack and call parameters View function.

Nowadays, I rarely use echo, print_r, var_dump and other system functions unless necessary to debug output. Basically, you can get what you want with this.

Especially for complex systems like drupal, you can clearly know how the program is executed.


Explanation:

The program is written in php4. It has been tested on php4.4.8 and 5.2.5, and it theoretically supports php4 and php5.

It has also been tested on linux, window, ie6-7, and firefox, but I still cannot guarantee that it will work in your environment. There are no errors when downloading. If there are any, please correct them yourself.

Please do not let the log file exceed 5M in size, as the browser may crash.
Download address http://www.jb51.net/codes/ 20851.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320486.htmlTechArticlePrinciple: 1. During the execution of the program, record the variables and call stacks you want to track in the corresponding places And the parameters of each function call, record this information to a file in a certain format, a...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn