1

I implemented a CodeIgniter hook to log all database transactions using the CI Profiler, as described here: CodeIgniter query log hook

It works fine, but surprisingly it doesn't "catch" most of INSERT and UPDATE operations. In the log file I only see the SELECTs, and I'm sure the application is working properly, since I can see the inserted/updated data on the page and in the database as well.

Using the $CI->output->enable_profiler(true); to show the Profiler on the views has exactly the same effect.

Would it be because my models extend a customized "parent" class (inside \core folder) instead of extend the CI_Model directly? Or it would be due AJAX requests?

Thanks in advance!

luizs81
  • 397
  • 2
  • 12

1 Answers1

0

I'm pretty sure, the profiler won't work if you use AJAX requests, the profiler report is generated on the server right before displaying your page. It won't be updated when using AJAX requests.

If you don't use AJAX you need to make sure the profiler is allowed to display enough queries (default 25), this can be changed by changing $config['query_toggle_count'] in application/config/profiler.php, see http://ellislab.com/codeigniter/user-guide/general/profiling.html for more details.

Sonaryr
  • 1,092
  • 1
  • 10
  • 24
  • Yes, on AJAX requests I don't expect the profiler information on page to be shown, since the page isn't refreshed, but in case of my "Profiler hook", I believe it should be fired anyway. About the "query_toogle_count", I also tried that, setting a very huge number in the config. By the way, I solved my problem writing a library that does exactly same thing and works fine. The only drawback is that I needed to change the models to insert the call for the library function. – luizs81 Nov 22 '13 at 05:44