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.
The documentation is being updated for oik-bwtrace v3.0.0. Please bear with me as I restructure it.
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.
- Dependent upon the oik base plugin
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.
- Easy to code APIs: bw_trace2(), bw_backtrace() and bw_trace()
- Tracing can be enabled programmatically
- Does not require
WP_DEBUGto be defined
- Dynamically activates trace functions
- Implemented as lazy just-in-time code
- Provides contextual information
- Action trace counts help you understand the sequence of actions and filters
- Can be used during regression testing
- Traces ALL server functionality, including AJAX and other background requests
- Minimum performance overhead when tracing is not enabled
- Can be activated in
db.phpto trace code before WordPress is fully loaded
- Does not need to be activated if started programmatically or from
- Ability to choose the IP address to trace, defaults to ALL requests
- Writes summary trace record for each transaction into a daily log
- Ad hoc tracing of user selected action hooks and filters
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 and Daily Trace Summary file
- 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