Recently I wanted to track all the queries being executed for one of my applications, and found a great way to turn on query logging. I would then tail the log file and run through my app to see which queries were actually being executed. My app is based on doctrine (1.2) and I was amazed at how many queries were being executed, but I will save that for another article.

set global log_output = 'FILE';

set global general_log = 'ON';

set global general_log_file = '/var/log/mysql/queries.log';