[development] Debugging updates

Earnie Boyd earnie at users.sourceforge.net
Fri Oct 19 16:43:27 UTC 2007


Quoting Karen Stevenson <karen at elderweb.com>:

> Does anyone have ideas for ways to debug update functions in the 
> install file figure out what's going on when they don't work as 
> expected or when I get reports of problems?
>
> Is there any way to see the query logs that the devel module creates 
> from within updates? If I use update_sql() I can tell what queries 
> ran, but there are times when I need to use db_query() instead and I 
> can get no clue to what is going on when that runs. And I can't find 
> any way to display messages back to myself or see results of 
> print_r() or any of the other things I do elsewhere to debug scripts.
>
> I've tried to execute the update() script directly from within a 
> normal page, but that won't work either.
>

Try setting ``output_buffering = Off'' in the php.ini file.  It's 
maddening to have it on when debugging.

I've been using the following function like so 
``vdump(__FILE__.'::'.__LINE__', $result);''

<code>
function vdump($label, &$data) {
echo '<table border="1" class="vdump"><tr><td>';
echo "$label</td><td>";
var_dump($data);
echo '</td></tr></table>'.NL;
ob_flush(); flush();
}
</code>

Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/



More information about the development mailing list