This blog covers briefly how to log queries in MySQL.
As of MySQL 5.1.12. It is possible to switch on or switch off query logging during runtime. The following switches on query logging in runtime:
SET GLOBAL general_log=’ON’;
The following switches off general log in runtime:
SET GLOBAL general_log=’OFF’;
By default, the general log file used by MySQL is located at /var/lib/mysql/host_name.log in ubuntu, where host_name is be the name of your machine.