Log Database Calls

Nov 27, 2008

I was helping someone debug some database calls with an CF based ORM the other day and showed him one of the hidden gems in CF 8. Figure this would make a good blog post since few people seem to know about it so far, So there's several ways to see the database calls going from CF to the datasource, but in CF 8 they included the JDBC Spy tool which allows you to log the database calls to a simple text file.

This will only work for certain datasource types: Sql Server, Oracle, DB2 or Sybase. It unfortunately doesn't work for MySQL, Access, Derby or PostgreSQL.

So when adding a new datasource or modifying an existing one, simply click on advance settings and scroll down about half way down. For example if it's a SQL Server datasource you should see a section called "Log Activity".

 

This option allows calls to the database to be log in a text file. Simply check that checkbox and specify the full path to a log file.Submit the settings and you should see that new log file which will start logging very detail information about the calls going between CF and the database. A very simple and handly tool to debug stuff. If you're on Windows, get a Tail program so you can actively monitor the log. You can google "jdbc spy" to get more information on the tool.

Important Note:
This log file will naturally contain very sensitive information and will grow very large if left unattended. Use it to debug things as needed, then turn off the log and remove the file.


Comments

dt

dt wrote on 12/02/088:44 PM

good tip to satisfy a requirement logging requirement on demand perhaps. thanks.
dt

dt wrote on 12/03/087:31 AM

good tip to satisfy a requirement logging requirement on demand perhaps. thanks.

Write your comment



(it will not be displayed)