Closed davidloubere closed 8 years ago
It should work, we're even using logger in tests to ensure exact number of queries was fired, you can check it out here: https://github.com/doctrine/mongodb-odm/blob/453ef86b8c499b05fefe9b67347b8b9c06e3f176/tests/Doctrine/ODM/MongoDB/Tests/Functional/AtomicSetTest.php#L27
So, I presume it is related to my configuration:
"silex/silex": "~1.3",
"doctrine/mongodb": "^1.2",
"doctrine/mongodb-odm": "^1.0",
"symfony/doctrine-bridge": "^2.7",
...
I am using Doctrine through the following Saxulum providers:
"saxulum/saxulum-doctrine-mongodb-odm-provider": "1.*",
"saxulum/saxulum-doctrine-mongodb-odm-manager-registry-provider": "^1.0",
Maybe I should look into that direction.
Closing because of no update in long time. @davidloubere if there's any news please feel free to update the issue.
davidloubere @davidloubere you must create document manager by "DocumentManager::create($connection, $configuration)",and you only set logger callable on $config.But the log callable should be setted on $connection.When creating document manager, dm's construct founction would not set $configuration into $connection included log callable.And i think it is a BUG. @malarzm @davidloubere @alcaeus @poulikov @jgornick
It should work, we're even using logger in tests to ensure exact number of queries was fired, you can check it out here:
I was looking for a way to replace the old logging feature and was glad I found this reply of yours as that lead me to CommandLogger :-)
setLoggerCallable
was removed from configuration in 2.0 version (but still exists in documentation). How I can get queries logs in that version?
There is a command logger that you can register. We no longer provide a way to log queries, instead using the APM functionality from the MongoDB driver to log queries. You can find an APM tutorial in the extension docs. We also provide a CommandLogger class that you can register as APM logger and look at queries later.
The ODM bundle for Symfony automatically registers loggers depending on the configuration, so no manual work is necessary there.
I tried to turn on query logging but to no avail.
As per the documentation, it would simply require to declare a callable to the
Doctrine\ODM\MongoDB\Configuration
instance.FYI, I'm retrieving the instance via the document manager within a controller like so:
Am I missing something?