From: Cliff <cl...@sl...> - 2003-10-18 11:50:38
|
Recently, I've been working on a more formal way of debugging the SQL associated with Slash sites that I happen to run. This came from me being sick and tired of having to navigate error logs after adding a "print $sql" to Slash::DB::Utility::prepare and trying to find the SPECIFIC SQL statement I wanted in the logs. Sooo... I hacked Slash::Apache and Slash::DB::Utility to provide a new Apache configuration directive for Slash: SlashDebugSQL "<space separated list of packages or scripts>" So. If I was looking for SQL associated for Search and for admin.pl, I'd add the following to my Apache conf: SlashDebugSQL "Slash::Search admin.pl" And ONLY the SQL from those files would be sent to the error logs. Note, that this is NOT designed for use on production servers (please!), this is for testing machines only, and uses a custom version of DB/Utility.pm to do its magic. I have yet to figure out how to roll this into Slash so that it is as unnoticeable as possible in a production environment. It's one of the reasons I haven't made a formal patch yet. If anyone has any ideas as to how I can alias Slash::DB::Utility::_prepare to one of two different subs depending on a boolean conditional, please let me know. I have ideas, I'm just not sure how well they work in practice and am still working at it. So would others be interested in me continuing work on formalizing this? Or would care for their own personal version of my changes? - Cliff |
From: Clifton W. <cl...@sl...> - 2003-10-23 03:01:38
Attachments:
SlashDebugSQL.patch
|
Here's the initial patch. It's been a while since I've done this so I hope I have it all in the first go. This should be patchable against the latest Slash version in CVS although it *may* (no guarantees) work for earlier T_ and R_ tags. To use, do the following. In your conf files, add: PerlModule Slash::DB::Utility::Debug SlashDebugSQL "<name of packages or files>" So: PerlModule Slash::DB::Utility::Debug SlashDebugSQL "Slash::Search admin.pl" Should dump all SQL executed by the Search plugin or the Admin script. At shane's request, I've added the following directive: SlashDebugSQLLog "/path/to/sql/log" Which does just about what you'd expect. If the log isn't specified, SQL is dumped to your error logs. Enjoy and let me know if any bugs unexpectedly slap you around. Patch is attached. - Cliff PS - Please note that the PerlModule and SlashDebug* directives only need to appear once in your conf files. |
From: Cliff <cl...@sl...> - 2003-10-24 15:45:37
|
On Thursday 23 October 2003 11:29, shane wrote: > On Wednesday 22 October 2003 20:19, Clifton Wood wrote: > > Installed the patch - thanks for the log mod - getting this: > > [Thu Oct 23 15:26:16 2003] [error] Can't use an undefined value as > an ARRAY reference at > /usr/local/lib/perl5/site_perl/5.8.0/i686-linux/Slash/DB/Utility/D >ebug.pm line 202. > > any suggestions? here's what's in the site's .conf: > > PerlModule Slash::DB::Utility::Debug > SlashDebugSQL "index.pl" > > SlashDebugSQLLog "/tmp/log" > > Shane Weird. I'm not getting that, but I've added more code to that routine to hopefully cut down on the fatal errors that can occur. I'll send another patch to the list when I've done some more testing. Thanks for trying it out. - Cliff |
From: Chris J. <jo...@nm...> - 2003-10-25 16:20:29
|
On Thu, 23 Oct 2003, Cliff wrote: > On Thursday 23 October 2003 11:29, shane wrote: > > On Wednesday 22 October 2003 20:19, Clifton Wood wrote: > > > > Installed the patch - thanks for the log mod - getting this: > > > > [Thu Oct 23 15:26:16 2003] [error] Can't use an undefined value as > > an ARRAY reference at > > /usr/local/lib/perl5/site_perl/5.8.0/i686-linux/Slash/DB/Utility/D > >ebug.pm line 202. > > > > any suggestions? here's what's in the site's .conf: > > > > PerlModule Slash::DB::Utility::Debug > > SlashDebugSQL "index.pl" > > > > SlashDebugSQLLog "/tmp/log" > > > > Shane > > Weird. I'm not getting that, but I've added more code to that routine > to hopefully cut down on the fatal errors that can occur. I'll > send another patch to the list when I've done some more testing. > > Thanks for trying it out. > > - Cliff > > Funny you should mention that. Remember I'm new here and there are lots of logs. The only mod I made was to install a task but that was last January and it was working. However I did find this after plowing through the slashd.log and it seems to have just started. Fri Oct 24 00:03:02 2003 new_headfoot.pl begin Error in library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on 'sections_summary;misc[misc];default[defaul t]', callers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Which was called by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Template/Co ntext.pm:133:Failed template lookup on 'sections_summary;misc[misc];default[default]', call ers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Error in library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on 'sections_summary;misc[misc];articles[defau lt]', callers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Which was called by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Template/Co ntext.pm:133:Failed template lookup on 'sections_summary;misc[misc];articles[default]', cal lers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Error in library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on 'sections_summary;misc[misc];ts1[default]', callers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Which was called by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Template/Co ntext.pm:133:Failed template lookup on 'sections_summary;misc[misc];ts1[default]', callers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Error in library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on 'sections_summary;misc[misc];features[defau lt]', callers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Which was called by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Template/Co ntext.pm:133:Failed template lookup on 'sections_summary;misc[misc];features[default]', cal lers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Error in library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on 'sections_summary;misc[misc];Optical[defaul t]', callers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Which was called by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Template/Co ntext.pm:133:Failed template lookup on 'sections_summary;misc[misc];Optical[default]', call ers: Slash::Display line 228, Slash::Utility::Anchor line 159, main line 42 Fri Oct 24 00:03:02 2003 new_headfoot.pl end (0.16s; freshenup.pl in 58s) ------------------------------------------------------------------------------- Chris Johnson |Internet: jo...@nm... Systems Administrator |Web: http://www.nmr.mgh.harvard.edu/~johnson NMR Center |Voice: 617.726.0949 Mass. General Hospital |FAX: 617.726.7422 149 (2301) 13th Street |Life n, a disease with 100% mortality. Charlestown, MA., 02129 USA | Me ------------------------------------------------------------------------------- |
From: Cliff <cl...@sl...> - 2003-10-24 18:57:34
|
OK, so assuming you haven't touched anything, it looks like templates have spontaneously lept out of your database because that's what those errors mean. See if you can find the following templates and reload them onto your site using template-tool: sections_summary;misc;default See if that at least makes things better. - Cliff On Friday 24 October 2003 13:28, Chris Johnson wrote: > Funny you should mention that. Remember I'm new here and > there are lots of logs. The only mod I made was to install a task > but that was last January and it was working. However I did find > this after plowing through the slashd.log and it seems to have > just started. > > > Fri Oct 24 00:03:02 2003 new_headfoot.pl begin > Error in > library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i3 >86-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on > 'sections_summary;misc[misc];default[defaul t]', callers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Which was called > by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Tem >plate/Co ntext.pm:133:Failed template lookup on > 'sections_summary;misc[misc];default[default]', call ers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Error in > library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i3 >86-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on > 'sections_summary;misc[misc];articles[defau lt]', callers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Which was called > by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Tem >plate/Co ntext.pm:133:Failed template lookup on > 'sections_summary;misc[misc];articles[default]', cal lers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Error in > library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i3 >86-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on > 'sections_summary;misc[misc];ts1[default]', callers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Which was called > by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Tem >plate/Co ntext.pm:133:Failed template lookup on > 'sections_summary;misc[misc];ts1[default]', callers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Error in > library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i3 >86-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on > 'sections_summary;misc[misc];features[defau lt]', callers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Which was called > by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Tem >plate/Co ntext.pm:133:Failed template lookup on > 'sections_summary;misc[misc];features[default]', cal lers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Error in > library:Slash::Display::Provider:/usr/lib/perl5/site_perl/5.6.1/i3 >86-linux/Slash/D isplay/Provider.pm:81:Failed template lookup on > 'sections_summary;misc[misc];Optical[defaul t]', callers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Which was called > by:Template::Context:/usr/lib/perl5/site_perl/5.6.1/i386-linux/Tem >plate/Co ntext.pm:133:Failed template lookup on > 'sections_summary;misc[misc];Optical[default]', call ers: > Slash::Display line 228, Slash::Utility::Anchor line 159, main > line 42 Fri Oct 24 00:03:02 2003 new_headfoot.pl end (0.16s; > freshenup.pl in 58s) > > > ------------------------------------------------------------------ >------------- Chris Johnson |Internet: > jo...@nm... Systems Administrator |Web: > http://www.nmr.mgh.harvard.edu/~johnson NMR Center > |Voice: 617.726.0949 > Mass. General Hospital |FAX: 617.726.7422 > 149 (2301) 13th Street |Life n, a disease with 100% > mortality. Charlestown, MA., 02129 USA | Me > ------------------------------------------------------------------ >------------- |
From: Chris J. <jo...@nm...> - 2003-10-28 17:55:27
|
On Fri, 24 Oct 2003, Cliff wrote: > OK, so assuming you haven't touched anything, it looks like > templates have spontaneously lept out of your database > because that's what those errors mean. > > See if you can find the following templates and reload > them onto your site using template-tool: > > sections_summary;misc;default > > See if that at least makes things better. > > - Cliff > > The sections_* templates are supposed to be generated by a task I put in almost a year ago. Very strange. I've got the tassk running again. And the errors are gone from the log. No clue how it happened. On another note, are there delays in updating templates or delays in showing them? Should they be distributed around the entire database immediately? I'm seeing differences in sections blocks where there shouldn't be any after my task runs. And the task is running without errors now. I have it writing it's own log and it is finding what it's supposed to. ------------------------------------------------------------------------------- Chris Johnson |Internet: jo...@nm... Systems Administrator |Web: http://www.nmr.mgh.harvard.edu/~johnson NMR Center |Voice: 617.726.0949 Mass. General Hospital |FAX: 617.726.7422 149 (2301) 13th Street |I'm continually amazed by mankind's seemingly Charlestown, MA., 02129 USA |infinite capacity for stupidity. Me ------------------------------------------------------------------------------- |
From: shane <sh...@lo...> - 2003-10-20 11:07:40
|
On Saturday 18 October 2003 07:18, Cliff wrote: > Recently, I've been working on a more formal way of debugging > the SQL associated with Slash sites that I happen to run. This > came from me being sick and tired of having to navigate error > logs after adding a "print $sql" to Slash::DB::Utility::prepare and > trying to find the SPECIFIC SQL statement I wanted in the > logs. > > Sooo... I hacked Slash::Apache and Slash::DB::Utility > to provide a new Apache configuration directive for Slash: > > SlashDebugSQL "<space separated list of packages or scripts>" > > So. If I was looking for SQL associated for Search and for admin.pl, > I'd add the following to my Apache conf: > > SlashDebugSQL "Slash::Search admin.pl" > > And ONLY the SQL from those files would be sent to the error > logs. nice. > Note, that this is NOT designed for use on production servers > (please!), this is for testing machines only, and uses a custom > version of DB/Utility.pm to do its magic. I have yet to figure out > how to roll this into Slash so that it is as unnoticeable as possible > in a production environment. It's one of the reasons I haven't > made a formal patch yet. If anyone has any ideas as to how I > can alias Slash::DB::Utility::_prepare to one of two different subs > depending on a boolean conditional, please let me know. I have > ideas, I'm just not sure how well they work in practice and am still > working at it. > > So would others be interested in me continuing work on formalizing > this? Yes >Or would care for their own personal version of my changes? Yes :) Please send me a patch. There's only one thing I think I'd change - Make it dump to it's own logfile, something like /{installdir}/sites/sitename/logs/sql.log. But that's debateable since I've not seen what you've done, obviously. Shane |
From: Cliff <cl...@sl...> - 2003-10-20 18:51:52
|
On Monday 20 October 2003 07:01, shane wrote: > There's only one thing I think I'd change - Make it dump to it's > own logfile, something like > /{installdir}/sites/sitename/logs/sql.log. But that's debateable > since I've not seen what you've done, obviously. Good idea, but that would take a lot more work. I might try and fit it in while I formalize what I have. I'll send to a patch sometime, today. Basically, I'm just performing a whole bunch of checks and printing to STDERR. I guess that could be diverted to a file, easily enough. Let me give it some thought. - Cliff |