Dynamically activated debug trace for WordPress, with Ad hoc action and filter hook tracing.
The oik-bwtrace plugin for WordPress enables you to see what’s going on in your server. It provides a user interface to dynamically activate tracing logic for browser requests, AJAX requests, REST API requests and command line interfaces.
Use oik-bwtrace to see what’s actually happening in your WordPress server.
Most of the documentation has been updated for oik-bwtrace v3.0.0. If you find a problem please raise an issue at bobbingwide/oik-bwtrace
Depending on the level of trace you choose the trace output may include some standard trace records produced by oik-bwtrace and trace records from the dormant debug trace function calls implemented in plugins and themes.
If you want to follow WordPress’s execution you may also want to activate the action trace logic. Using the action trace helps you to determine the sequence of action and filter calls in your WordPress site without having to resort to using a PHP debugger or other low level profiling functionality.
Debug trace for WordPress
- The primary purpose of debug trace is to help in the development of PHP code: plugins or themes.
- The primary purpose of action trace is to help you understand the sequence of events in the server.
- This plugin provides the admin interface to trace functions and action and filter tracing built into plugins that use the oik / bw APIs.
Except for HTML comments, neither oik bwtrace nor oik action trace alters the output of your web pages.
They write their output to a file on the server which you can browse in a separate window.
You can also use the oik trace facilities to assist in problem determination in a live site.
- Traces to a defined Trace files directory
- Traces ALL server functionality, including AJAX, REST and other background requests
- Writes summary trace record for each transaction into Daily Trace summary files
- Traces browser transactions separately, if required
- Traces AJAX transactions separately, if required
- Traces REST requests separately, if required
- Traces CLI requests separately, if required
- Ability to choose the IP address to trace, defaults to ALL requests
- Supports ad hoc tracing of user defined hooks
- Action trace counts help you understand the sequence of actions and filters
- Provides contextual information
- Minimum performance overhead when tracing is not enabled
- Tracing can be enabled programmatically
- Traces and backtraces PHP Error, Warning and Notice messages
- Backtraces deprecated logic messages
- Does not require WP_DEBUG to be defined
- Does not require SAVEQUERIES to be defined
- Dynamically activates trace functions
- Implemented as lazy just-in-time code
- Can be used during regression testing
- Can be activated in wp-config.php and db.php to trace code before WordPress is fully loaded
- Plugin does not need to be activated if started programmatically or from wp-config.php
- Operates as a standalone plugin
- Integrated with oik-lib shared library management
- Easy to code APIs: bw_trace2(), bw_backtrace().
- API supports multiple trace levels
Trace record files
Trace output is logged to trace files in a trace files directory.
The trace record output can include:
- Fully qualified source file name
- Trace record count
- Time stamp
- Current post ID
- Number of database queries that have been performed.
- Current and peak memory usage (in bytes)
Daily trace summary report
The daily trace summary report logs the activity in your site.
Checking the Trace ‘shutdown’ status report and log in summary file checkbox in Settings > action options will cause oik-bwtrace to record a summary record for each transaction in your server.
A new file is created every day. See Daily trace summary.
Use the following APIs to debug your own code
- Trace APIs
- An introduction to problem determination with oik-bwtrace – debug trace for WordPress
- Getting started with oik-bwtrace v3.0.0
- Viewing trace files
- Settings > oik trace options
- Settings > oik action options
- Action options – options
- Count action hooks and filters
- Trace deprecated messages
- Trace Error, Warning and Notice messages
- Trace ‘wp’ action
- Trace ‘wp’ global wp_rewrite
- Purge trace file if no errors
- Trace ‘shutdown’ included files
- Trace ‘shutdown’ saved queries
- Trace ‘shutdown’ output buffer
- Trace ‘shutdown’ trace functions count
- Trace ‘shutdown’ status report
- Settings > oik action options – Ad hoc tracing
- Action options – options
- Start tracing from wp-config.php
- Trace output file
- WordPress plugins for debugging or problem determination
- oik-bwtrace Must-Use and Drop-In logic
- Deprecated or deleted or legacy logic and documentation