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. Ideas welcome! Karen
Hi, What I usually do is turn off js and then I can just use var_dump() to print to the page, or you can just return the messages as errors from the hook_update_n() like $ret[] = array( 'success' => false, 'query' => t('Default currency needs to be set before the update can continue. Use the <a href="!link">Receipt type settings</a> to set the default currenecy', array('!link' => url('admin/ecsettings/rtypes/settings'))) ); I used this in e-Commerce to stop the update (with a little extra code to remove the additional updates), but it should not interfer Gordon. Karen Stevenson wrote:
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.
Ideas welcome!
Karen
!DSPAM:1000,4718c26495981804284693!
You could try editing the $debug flag in _db_query to defualt to true. And then either disable js like Gordon suggests, or change the debug print to watchdog. -tao Gordon Heydon wrote:
Hi,
What I usually do is turn off js and then I can just use var_dump() to print to the page, or you can just return the messages as errors from the hook_update_n() like
$ret[] = array( 'success' => false, 'query' => t('Default currency needs to be set before the update can continue. Use the <a href="!link">Receipt type settings</a> to set the default currenecy', array('!link' => url('admin/ecsettings/rtypes/settings'))) );
I used this in e-Commerce to stop the update (with a little extra code to remove the additional updates), but it should not interfer
Gordon.
Karen Stevenson wrote:
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.
Ideas welcome!
Karen
!DSPAM:1000,4718c26495981804284693!
On 10/19/07, Karen Stevenson <karen@elderweb.com> wrote:
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.
Depending on the project and version you need to debug your updates between, you might be able to use watchdog() to log data and then inspect your logs. Gabor
Quoting Karen Stevenson <karen@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/
I haven't used it much, but devel has the ability to store all queries into the database. see admin/settings/devel. unfortunately, devel_shutdown() specifically bails on update.php because we used to output gunk and wreck the JSON thats returned. We should really be smarter and allow the logging but not allow output to screen. patches welcome. On 10/19/07, Karen Stevenson <karen@elderweb.com> wrote:
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.
Ideas welcome!
Karen
On 10/19/07, Karen Stevenson <karen@elderweb.com> wrote:
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.
You could try: http://drupal.org/project/trace I often have the trace log open in a terminal, monitoring it in realtime with "tail -f files/trace.log". This allows a convenient "side channel" for debug messages, which you can print out e.g. with trace('debug', $my_troublesome_var); The module will trace the SQL queries, too. You can limit it to e.g. only output UPDATE queries. -- Arto Bendiken | http://bendiken.net/
participants (7)
-
Arto Bendiken -
Earnie Boyd -
Gordon Heydon -
Gábor Hojtsy -
Karen Stevenson -
Moshe Weitzman -
Tao Starbow