![]() |
Log SQL Queries - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Log SQL Queries (/showthread.php?tid=36876) |
Log SQL Queries - El Forum - 12-17-2010 [eluser]Unknown[/eluser] Is there a way to log all sql queries? I see that database sql errors are logged but is there a way to log all queries without modifying the core DB_Driver file? Log SQL Queries - El Forum - 12-18-2010 [eluser]centurionas[/eluser] If you run CI on dedicated host you can enable the general mysql query log. Check the manual http://dev.mysql.com/doc/refman/5.1/en/query-log.html Log SQL Queries - El Forum - 12-18-2010 [eluser]pickupman[/eluser] How about the output class. Code: $this->output->enable_profiler(TRUE); CI already does this. You can view the code in the method show above. The code will append to the bottom of the page execution time, memory usage, POST, config, and queries. The profiler access a property from the DB class to get all executed queries. The method actually calls _compile_queries() method from the Profiler class. Log SQL Queries - El Forum - 08-31-2012 [eluser]Unknown[/eluser] Use this code first enable hook on application/config/config.php file: $config['enable_hooks'] = TRUE; then Code: /* config/hooks.php */ |