Pierre de LESPINAY
Pierre de LESPINAY

Reputation: 46178

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 ?

Upvotes: 6

Views: 8489

Answers (2)

AJ Cerqueti
AJ Cerqueti

Reputation: 716

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.

Upvotes: 14

Pierre de LESPINAY
Pierre de LESPINAY

Reputation: 46178

$ tail -f app/logs/dev.log | grep "doctrine.DEBUG"

Upvotes: 3

Related Questions