Quantcast
Channel: Riff Blog - Surfing the dataverse, to the sound of music
Viewing all articles
Browse latest Browse all 79

Logging for MongoDB

$
0
0

One nice thing during Drupal 7/8 development is the ability, thanks to the devel module, to get a list of all SQL queries ran on a page. As I've been working quite a bit on MongoDB in PHP recently, I wondered how to obtain comparable results when using MongoDB in PHP projects. Looking at the D7 implementation, the magic happens in the Database class:

<?php
// Start logging on the default database.
define(DB_CHANNEL, 'my_logging_channel');
\
Database::startLog(DB_CHANNEL);

// Get the log contents, typically in a shutdown handler.
$log = \Database::getLog(DB_CHANNEL);
?>

With DBTNG, that's all it takes, and devel puts it to good use UI-wise. So is there be an equivalent mechanism in MongoDB ? Of course there is !

read more


Viewing all articles
Browse latest Browse all 79

Trending Articles