Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The devel_query_put_contents() function is preventing the query log from displaying while I'm trying to do performance tuning on my site.
If I comment out the following line #1082 of the devel_query_put_contents() function, the query log displays as expected:
file_put_contents($path, @json_encode($queries));
This is happening on a copy of my laptop (Macbook Pro running OSX10.6) that I set up using the Acquia Drupal Control Panel v 1.2.30.
Comments
Comment #1
salvisPlease try the -dev version.
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedNo reply
Comment #3
ermannob CreditAttribution: ermannob commentedHi,
I'm experiencing the same problem. I'm using devel 7.x-1.2+32-dev.
My drupal is 7.12 on MAMP (OSX).
I'm having this problem only on one page, generated by a custom module made by me. Looking at the page source (HTML code) the query log is completely missing.
Thanks.
Comment #4
hefox CreditAttribution: hefox commentedthe @ on the json_encode meant that a fatal error due to time limit exceeding was never reported, meaning the query log mysteriously didn't appear on some pages.
:(
Comment #5
Kars-T CreditAttribution: Kars-T commentedHi
I can confirm this problem.
Line 1274 latest dev
I am checking a really messed up site that seems to enter > 5.000 queries to the query log. json_encode() will just fail. And by this I won't get anything from the shutdown function.
Exact message is:
I don't have an idea because this of course is just too much. Maybe the array should just be truncated? Maybe add a setting about max log size? Or maybe just add a warning text to the admin interface?
Comment #6
salvisI wonder why the @ operator is not working here...
Look in Google for your message to get some other ideas about what could be wrong with your data.
Comment #7
dwightaspinwall CreditAttribution: dwightaspinwall commentedI can also confirm this issue in 7.x-1.x-dev. Certain pages show the query log, others not. In my case the home page didn't show queries (or any other post-body output), even though there were only about 700 queries. Was tricky to track down the problem because the @ suppressed error logging. Because the fatal error comes so late in the page load, it doesn't even appear at all that there is an error. Looks more like a theming or configuration issue.
Not sure what the right approach is for a fix, nor even clear on the purpose of the call to file_put_contents() at all, since commenting out this line causes the queries to appear as normal. Maybe a try/catch with a notice?
Comment #8
willzyx CreditAttribution: willzyx commentedSee #2465025: SQL query log doesn't work on pages generated by a view; the patch #1 should solve the issue
Comment #9
willzyx CreditAttribution: willzyx commentedClosing this, since in #2465025: SQL query log doesn't work on pages generated by a view we solve this issue. Feel free to reopen if you think that the problem is still present.