×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Troubleshooting Techniques

Log each query call to the dB to see which query is troublesome by GUJUm0deL
Posted: 18 Feb 05

Hey all, I had some major issues with my company's site and didn't know why our site kept crashing.  Well, the actual reason was something quite different, but as I was trying to debug I implemented this technique to help troubleshoot in the future.

The idea is to log all query calls to the dB to see which query takes an abnormal time to process.  You can then look at the logfiles table to see the count.

THE CODE:

CODE

<cfset gm_startTime = gettickcount()>
<cfquery name="testQuery" datasource="#ds#">
  select user_id, name, address, city, state, zip
  from users
  where user_id = '#url.user_id#'
</cfquery>
<cfset gm_endTime = gettickcount()>
<cfset totalTime = (gm_endTime - gm_startTime)/1000>

...
...
...

<cfquery name="logrecs" datasource="#ds#">
  insert into LOGFILE(pagecall,starttime,endtime,totaltime,createdate,queryname)
  vales('page1.cfm',#gm_startTime#,#gm_endTime#,#totalTime#,getdate(),'testQuery')
</cfquery>

Now if/when your site acts odd you can check this table first to see if the culprit is any query processing.

Back to Adobe FAQ Index
Back to Adobe Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close