Log queries to FirePHP console with Monolog

Submitted by xtrasmal - 5 years ago

Use this trick to log queries using Monolog. Add this to your routes.php and log straight into your Firebug console. Firebug needs the FirePHP add-on. - kisses Netbulae

DB::listen(function($query)
{
    
    // Get an instance of Monolog
    $monolog = Log::getMonolog();
    // Choose FirePHP as the log handler
    $monolog->pushHandler(new \Monolog\Handler\FirePHPHandler());
    // Start logging
    $monolog->addInfo('SQL', array('query' => $query));


});


// Or you could do the following which has the same effect.

Event::listen('illuminate.query', function($query)
{
   // Log, log, it's big it's heavy it's wood 
});
comments powered by Disqus