MongoDB java driver Logging the queries
<p>Using mongodb java driver:</p>

<pre><code>         &lt;dependency&gt;
            &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
            &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
            &lt;version&gt;3.2.2&lt;/version&gt;
        &lt;/dependency&gt;
</code></pre>

<p>We are using logback.xml file for logging and I want to log all the queries that are fired to Mongo. I added:</p>

<pre><code>&lt;logger name="org.mongodb" level="INFO"&gt;&lt;/logger&gt;
</code></pre>

<p>which did not solve the problem, so then I did</p>

<pre><code>&lt;logger name="log4j.logger.org.mongodb.driver" level="INFO"&gt;&lt;/logger&gt;
</code></pre>

<p>but that did not help either.</p>

<p>Can someone please guide me. Or tell me if there is another way I can log the queries to Mongo in /var/log/mongodb/mongo.log that can also help.</p>