问题
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.
来源:https://stackoverflow.com/questions/2800226/how-to-log-all-doctrine-queries-to-file