Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 - Doctrine log

I'd like to see all doctrine queries called.

I know the dev bar, but it does not show queries processed through Ajax.

How can I see all doctrine queries fired ?

like image 253
Pierre de LESPINAY Avatar asked Mar 26 '13 12:03

Pierre de LESPINAY


2 Answers

To expand on your answer, especially on dev, I prefer to split each of my log channels so I can easily pipe each to their own output.

In config_dev.yml, add:

monolog:
   handlers:
   [...]
      doctrine:
            action_level: debug
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%_doctrine.log
            channels: doctrine

Then

tail -f app/logs/dev_doctrine.log

will give you a nice clean stream of every transaction as it happens. I add one for event, request and security also, but this is all personal preference, naturally.

like image 127
AJ Cerqueti Avatar answered Sep 26 '22 13:09

AJ Cerqueti


$ tail -f app/logs/dev.log | grep "doctrine.DEBUG"
like image 41
Pierre de LESPINAY Avatar answered Sep 26 '22 13:09

Pierre de LESPINAY