2.10 docs are outdated, need a solution for logging a failing query. #9222
-
https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/advanced-configuration.html This still references Doctrine\DBAL\Logging\EchoSQLLogger which is gone. The only logger I am currently aware of is DebugStack(deprecated) and I believe that collects queries so if there is an exception I don't actually get to see any queries that were run. I see no documented solution for actually logging queries as they happen. If the answer is implement the SQLLogger interface I will do that, but that is not at all user friendly for something as integral to the orm as sql logging. Any advice would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You're apparently working with DBAL 3 already. You are right, the documentation for logging, both in DBAL and ORM, is outdated and incomplete. DBAL 3.2 has introduced a new middleware for logging (see doctrine/dbal#4967) that basically allows you to plug in a PSR-3 logger. When configuring your DBAL connection, instead of calling… $config->setSQLLogger($someLegacySqlLogger); … you call … $config->setMiddlewares([
new Doctrine\DBAL\Logging\Middleware($yourPsr3Logger)
]) |
Beta Was this translation helpful? Give feedback.
You're apparently working with DBAL 3 already. You are right, the documentation for logging, both in DBAL and ORM, is outdated and incomplete. DBAL 3.2 has introduced a new middleware for logging (see doctrine/dbal#4967) that basically allows you to plug in a PSR-3 logger.
When configuring your DBAL connection, instead of calling…
… you call …