From karen@elderweb.com Fri Oct 19 14:54:27 2007 From: Karen Stevenson To: development@drupal.org Subject: [development] Debugging updates Date: Fri, 19 Oct 2007 07:47:40 -0700 Message-ID: <295525.24915.qm@web60025.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4570538347572037788==" --===============4570538347572037788== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 re= ports of problems?=20 Is there any way to see the query logs that the devel module creates from wit= hin 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 t= o myself or see results of print_r() or any of the other things I do elsewher= e 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 --===============4570538347572037788==-- From gordon@heydon.com.au Fri Oct 19 15:05:24 2007 From: Gordon Heydon To: development@drupal.org Subject: Re: [development] Debugging updates Date: Sat, 20 Oct 2007 01:05:00 +1000 Message-ID: <4718C79C.2060500@heydon.com.au> In-Reply-To: <295525.24915.qm@web60025.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0414911678495979475==" --===============0414911678495979475== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 Receipt type settings 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! > --===============0414911678495979475==-- From gabor@hojtsy.hu Fri Oct 19 15:15:08 2007 From: =?utf-8?q?G=C3=A1bor?= Hojtsy To: development@drupal.org Subject: Re: [development] Debugging updates Date: Fri, 19 Oct 2007 17:07:50 +0200 Message-ID: <86ca3ccb0710190807w5b628f52ne10099e303795534@mail.gmail.com> In-Reply-To: <295525.24915.qm@web60025.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5623584253132660549==" --===============5623584253132660549== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On 10/19/07, Karen Stevenson wrote: > Does anyone have ideas for ways to debug update functions in the install fi= le 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 w= ithin updates? If I use update_sql() I can tell what queries ran, but there a= re 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 elsewh= ere to debug scripts. > > I've tried to execute the update() script directly from within a normal pag= e, 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 --===============5623584253132660549==-- From earnie@users.sourceforge.net Fri Oct 19 16:43:39 2007 From: Earnie Boyd To: development@drupal.org Subject: Re: [development] Debugging updates Date: Fri, 19 Oct 2007 12:43:27 -0400 Message-ID: <20071019124327.r0grsq9lxb28w884@mail.progw.org> In-Reply-To: <295525.24915.qm@web60025.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2815322469813327871==" --===============2815322469813327871== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Quoting Karen Stevenson : > 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);'' function vdump($label, &$data) { echo '
'; echo "$label"; var_dump($data); echo '
'.NL; ob_flush(); flush(); }
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/ --===============2815322469813327871==-- From weitzman@tejasa.com Fri Oct 19 16:59:08 2007 From: Moshe Weitzman To: development@drupal.org Subject: Re: [development] Debugging updates Date: Fri, 19 Oct 2007 12:59:02 -0400 Message-ID: <6117a7500710190959w14ecca49qfc3eb7f3f972ddb7@mail.gmail.com> In-Reply-To: <295525.24915.qm@web60025.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6579254462253782911==" --===============6579254462253782911== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 wrote: > Does anyone have ideas for ways to debug update functions in the install fi= le 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 w= ithin updates? If I use update_sql() I can tell what queries ran, but there a= re 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 elsewh= ere to debug scripts. > > I've tried to execute the update() script directly from within a normal pag= e, but that won't work either. > > Ideas welcome! > > Karen > > --===============6579254462253782911==-- From starbow@citris-uc.org Fri Oct 19 17:11:22 2007 From: Tao Starbow To: development@drupal.org Subject: Re: [development] Debugging updates Date: Fri, 19 Oct 2007 10:11:10 -0700 Message-ID: <4718E52E.3090007@citris-uc.org> In-Reply-To: <4718C79C.2060500@heydon.com.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9096879061903450389==" --===============9096879061903450389== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 Receipt type settings 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! >> >> --===============9096879061903450389==-- From arto.bendiken@gmail.com Fri Oct 19 20:53:23 2007 From: Arto Bendiken To: development@drupal.org Subject: Re: [development] Debugging updates Date: Fri, 19 Oct 2007 22:53:16 +0200 Message-ID: <47fe11b70710191353s462bc745u298c3958d11392e2@mail.gmail.com> In-Reply-To: <295525.24915.qm@web60025.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4137265969696326670==" --===============4137265969696326670== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On 10/19/07, Karen Stevenson wrote: > Does anyone have ideas for ways to debug update functions in the install fi= le 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 w= ithin updates? If I use update_sql() I can tell what queries ran, but there a= re 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 elsewh= ere 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. --=20 Arto Bendiken | http://bendiken.net/ --===============4137265969696326670==--