oik-bwtrace – debug trace for WordPress

Dynamically activated debug trace for WordPress, with optional action and filter hook tracing. The oik-bwtrace plugin for WordPress provides provides a user interface to dynamically activate the dormant debug trace function calls implemented in plugins and other code that uses the oik trace API functions.

For normal problem determination tracing you can enable normal tracing of the bw_trace2() and bw_backtrace() calls.

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.

Use oik-bwtrace to see what’s actually happening in your WordPress server.

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.

Features

  • Easy to code APIs: bw_trace2(), bw_backtrace() and bw_trace()
  • Tracing can be enabled programmatically
  • Does not require WP_DEBUG to 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 wp-config.php and db.php to trace code before WordPress is fully loaded
  • Does not need to be activated if started programmatically or from wp-config.php
  • Ability to choose the IP address to trace, defaults to ALL requests
  • Writes summary trace record for each transaction into a daily log

Trace record file

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 log

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 report – bwtrace.vt.mmdd.

Public APIs

Use the following APIs to debug your own code