Home php教程 php手册 PHPLog php 程序调试追踪工具

PHPLog php 程序调试追踪工具

Jun 13, 2016 pm 12:22 PM
php principle exist place tool of program Record debug track

原理:

    1.程序执行的过程中,在相应的地方记录你想要追踪的变量及调用栈和每次函数调用的参数,
          把这些信息以一定的格式记录到文件,一个变量一行,具体数据格式请参看代码,这里不细讲.

    2.现在有了每次记录变量时的所有信息(包括调用栈及参数),当你通过浏览器访问这个程序时, 这个程序会把整个文件读取分析,
          在页面显示你的所有调试信息,并且它会动态ajax刷新,保持与你的调试同步.

    画个图吧,要清晰得多.



     BackTrace也就是调用栈信息,没有在图中体现,是ajax动态刷新的.


功用:

      再截几个本机的图说明下:

     1.包含文件,调试变量(上面是程序,下面是apache_request_headers()的调试输出)



     2.drupal系统某次函数的调用栈列表
 



     3.栈中某个函数的调用参数




后记:


   程序基本上实现了调试,追踪php变量的功能,还附带了调用栈及调用参数查看功能.

   现在echo,print_r,var_dump等系统函数,如非必要时,本人已很少用来调试输出了,基本上用这个就可以得到想要的东西了.

   特别是像drupal这类复杂的系统,能够清楚地知道程序是怎么执行的.


说明:

    程序是用php4的写法写成的,在php4.4.8, 5.2.5上测试过, 理论上是支持php4, php5的.

    linux, window, ie6-7, firefox下也都测试过,但还是不敢保证在你的环境下不出错,如有,请自行修正.

    请不让log文件超过5M大小,浏览器可能会崩溃的.
下载地址 http://www.jb51.net/codes/20851.html
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

How to efficiently integrate Node.js or Python services under LAMP architecture? How to efficiently integrate Node.js or Python services under LAMP architecture? Apr 01, 2025 pm 02:48 PM

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

How to configure apscheduler timing task as a service on macOS? How to configure apscheduler timing task as a service on macOS? Apr 01, 2025 pm 06:09 PM

Configure the apscheduler timing task as a service on macOS platform, if you want to configure the apscheduler timing task as a service, similar to ngin...

Can Python parameter annotations use strings? Can Python parameter annotations use strings? Apr 01, 2025 pm 08:39 PM

Alternative usage of Python parameter annotations In Python programming, parameter annotations are a very useful function that can help developers better understand and use functions...

How to ensure high availability of MongoDB on Debian How to ensure high availability of MongoDB on Debian Apr 02, 2025 am 07:21 AM

This article describes how to build a highly available MongoDB database on a Debian system. We will explore multiple ways to ensure data security and services continue to operate. Key strategy: ReplicaSet: ReplicaSet: Use replicasets to achieve data redundancy and automatic failover. When a master node fails, the replica set will automatically elect a new master node to ensure the continuous availability of the service. Data backup and recovery: Regularly use the mongodump command to backup the database and formulate effective recovery strategies to deal with the risk of data loss. Monitoring and Alarms: Deploy monitoring tools (such as Prometheus, Grafana) to monitor the running status of MongoDB in real time, and

In LangChain, how do I use AgentExecutor to replace the disabled initialize_agent function? In LangChain, how do I use AgentExecutor to replace the disabled initialize_agent function? Apr 01, 2025 pm 04:18 PM

How to replace the disabled initialize_agent function in LangChain? In the LangChain library, initialize_agent...

How to teach computer novice programming basics in project and problem-driven methods within 10 hours? How to teach computer novice programming basics in project and problem-driven methods within 10 hours? Apr 02, 2025 am 07:18 AM

How to teach computer novice programming basics within 10 hours? If you only have 10 hours to teach computer novice some programming knowledge, what would you choose to teach...

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

See all articles