News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ServerGrove Blog:
Logging MongoDB queries using Symfony 2 and Doctrine ODM
October 05, 2010 @ 10:56:43

On the ServerGrove blog today there's a quick new post showing a method you can use to log the queries to your MongoDB database in your Symfony2-based application.

Symfony 2 comes with native support to connect to MongoDB using the DoctrineMongoDBBundle. Getting started is quite simple and there is not much that needs to be configured, but the manual does not say how to enable query logging although it is already possible with Symfony PR3. Query logging allows you to debug queries sent to the DB server by writing them in a log file. It is very useful for cases when you issue a query and you are not getting the results you expected.

The key is to add a "logger_class" value into your Symfony configuration file pointing to the "DoctrineMongoDBLogger" tool. The queries will then show up in your normal log files. They include a sample line along with a brief explanation of the values inside.

0 comments voice your opinion now!
mongodb tutorial symfony doctrime odm log query


blog comments powered by Disqus

Similar Posts

PHPMac.com: Building and Installing Apache 2.2.2 and PHP 5.1.3 (or 5.1.4) on Mac OS X 10.4.6

SitePoint PHP Blog: Integrating Polymer/Dart and Symfony Part 1

Rob Allen's Blog: Zend Framework Tutorial for 0.7

The Bakery: 13 New Tutorials and Articles Posted

Abhinav Singh's Blog: Setting Nginx, PHP Fastcgi and XCache on a new Ubuntu


Community Events





Don't see your event here?
Let us know!


interview release zendserver introduction community developer laravel list deployment threedevsandamaybe podcast application tips series development api framework language conference code

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework