The output from the oik-bwtrace plugin is written to an output file on your WordPress server.
This documentation assumes the file name is bwtrace.loh
.
Since nine times out of ten you will want to view the trace log in one window and the web page in another and since some browsers will attempt to download a .log
file, rather than display it within the browser, we use the .loh
extension.
The general structure of a trace log record is a series of fields separated by spaces. Here’s an example split over multiple lines
wp-content\plugins\bobbing\bobbing.php(51:0) bobbing_init(3) 98 2015-10-14T11:01:38+00:00 2.271757 0.001041 cf=init,oik_loaded 12 0 48288792/48452760 F=390 the ultimate answer 42
The fields are:
Field | Comment | |
---|---|---|
sourcefile(lineno:level) | the sourcefile may be fully qualified with ABSPATH | |
function(invocation count) | number of calls to trace from this function | |
trace record count | ||
timestamp | ||
elapsed | since transaction started | |
interval | since previous trace record | |
context including current filter | shows filter tree | |
number of queries | ||
post ID | ||
memory/peak usage | in bytes | |
files loaded | ||
field label | ||
field value | ||
bwecho’d content |
Some of the fields are optional. The contents of each trace record can be selected using Settings > oik trace options.
The field value is printed using the PHP print_r() function or an equivalent function ( bw_trace_obsafe_print_r() ). It will print all the values of an array or object. For large arrays or objects this may produce a lot of output.
When the bw_trace2() API is called without any parameters then it will trace the current values of the parameters that were passed to the function.
Note: Remember that the trace output file is publicly accessible. If you do enable tracing on a live site then you should remember to disable it when you have finished and ensure the file is deleted.