简体   繁体   中英

Zend Framework 2 how to log sql to FirePHP

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?

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');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM