Zend Framework 2 how to log sql to FirePHP

367 views Asked by At

logging sql to FirePHP is very simple in Zend 1, just put setting like this:

'db' => array(
    'adapter' => 'pdo_mysql',
    'params' => array(
         'profiler' => array(
             'enabled' => true,
             'class' => "Zend_Db_Profiler_Firebug"
         )
    ),
    'isDefaultTableAdapter' => true
),

what's config similar in zend 2?

1

There are 1 answers

0
Andrew On

You can just configure the logger to write to FirePHP

Service Manager config:

'FirePHPLogger' => function($sm){
    $writer = new Zend\Log\Writer\FirePHP();
    $logger = new Zend\Log\Logger;
    $logger->addWriter($writer);

    return $logger;
},

Then you can log anything:

$serviceManager->get('FirePHPLogger');
$logger->info('Informational message');