How to get Doctrine to log queries in Symfony2

后端 未结 2 1594
半阙折子戏
半阙折子戏 2021-02-20 15:15

I\'m pretty new to Symfony2, and I\'m looking for a way to log SQL queries (including timings) to the same log file as the rest of my application.

From what I can determ

2条回答
  •  时光说笑
    2021-02-20 15:39

    Full example of config:

    config/packages/dev/doctrine.yaml:

    doctrine:
        dbal:
            connections:
                default:
                    logging: true
    

    If you still don't have monolog, install it: composer require symfony/monolog-bundle and you should start getting all SQL queries in the log file: var/log/dev.log

提交回复
热议问题