How to log all Doctrine queries to file?

2019-06-18 06:59发布

问题:

I'm using Doctrine and want to log all generated SQL queries.

I know that I could use $q->getSqlQuery() but I don't want to do that manually each time.

Is there a way to do it automatically?

回答1:

If you turn logging on all queries shoudl be logged to your application log in the log directory. To do this set logging_enabled to true in your settings.yml.



回答2:

Take a look at Doctrine Profiler and the source of ZF_Debug & Doctrine.



标签: doctrine