Skip to content

"Query Logging is Disabled" - Not sure why? #107

atrauzzi opened this Issue May 30, 2012 · 5 comments

3 participants



I'm in the process of trying to get the sensio/framework-extra-bundle's DoctrineParamConverter working with MongoDB.


Unfortunately, I can't really tell if the DB is being queried at all, because when I go to the Symfony Profiler and click the "Doctrine MongoDB" tab, I get the message "Query logging is disabled."

I'm fairly certain I have the MongoDB Bundle up and running in my project, as I don't think I'd be getting this tab otherwise.

The real confusion is that by all accounts, I think I should be getting logging by default while in development mode. In Configuration.php, I'm seeing:

        ->treatTrueLike(array('enabled' => true))
        ->treatFalseLike(array('enabled' => false))

Here's the chunk of YAML that I'm using to configure things:

              server: mongodb://localhost:27017
                  connect: true
      default_database: nerve
            auto_mapping: true

So, even if there was an issue with my ParamConverter - at the very least I should be able to see whether queries have been run or not by simply adding the MongoDB Bundle to my kernel and checking it in the profiler.

This does not appear to be the case. Thanks for hearing me out!

Doctrine member
jmikola commented May 30, 2012

Let's start by narrowing down the issue to either the extension class or the profiler itself. Can you pop into the DoctrineMongoDBExtension class and check if the conditional under // profiler (around line 170) actually tags the profiler service? In your case, if %kernel.debug% is true, I assume it will be doctrine.odm.mongodb.data_collector.pretty.


I got out my club and did a quick die-debug inside both of these conditions, and both happen. So the configuration settings are both resolving to true in my environment.

        // logging
        $loggers = array();
        if ($container->getParameterBag()->resolveValue($documentManager['logging'])) {

            // This happens.
            die("Logging is on!");

            $loggers[] = new Reference('doctrine.odm.mongodb.logger');


        // profiler
        if ($container->getParameterBag()->resolveValue($documentManager['profiler']['enabled'])) {

            // This happens too (but obviously not in the same request!).
            die("Profiler is on!");

            $dataCollectorId = sprintf('doctrine.odm.mongodb.data_collector.%s', $container->getParameterBag()->resolveValue($documentManager['profiler']['pretty']) ? 'pretty' : 'standard');
            $loggers[] = new Reference($dataCollectorId);
                ->addTag('data_collector', array( 'id' => 'mongodb', 'template' => 'DoctrineMongoDBBundle:Collector:mongodb'))

While I wait to hear back, I'll poke around to see if I can find out anything about the profiler myself, although if you have somewhere specific for me to look there, let me know.


Looking at the template gives me a hunch as to what might be going on here. It's not that the queries aren't being logged, it may be that none are being generated?

    {% if not collector.queries %}
            <em>Query logging is disabled.</em>
    {% elseif not collector.querycount %}

If that's the case, might I suggest that the text in between the em tags be changed to "No queries made."? If my suspicion here is right, this information is misleading and has resulted in me suspecting Doctrine rather than the ParamConverter! :)

Doctrine member
jmikola commented May 31, 2012

Ah, it looks like you found it. Neither Jon Wage or I have worked on the WDT template, so I'm not sure how to differentiate between no queries and a disabled logger. My first assumption is that if query logging was off, the template wouldn't even show up in the WDT (but I could be mistaken).

Perhaps one of these guys could assist:

/ping @vicb @hhamon

vicb commented Jun 1, 2012

The collector is a logger so it should be safe to change the text to <em>No queries made.</em>

@jmikola jmikola was assigned Jun 14, 2012
@jmikola jmikola closed this in 8374776 Jun 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.