Reputation: 7553
Is there any way to log SQL query execution time with queries? Currently only queries and their params are logged (into doctrine.DEBUG
channel).
Symfony 2 (actually 2.0, cannot be updated) and Doctrine 2.2
Upvotes: 1
Views: 3316
Reputation: 2137
From a container aware object, such as your controllers or commands, you can enable logging like this.
$this
->get('doctrine')
->getConnection()
->getConfiguration()
->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
This will set up EchoSQLLogger to do your logging for you, which results in every query and its parameters being printed with echo and var_dump().
Upvotes: 1