views:

36

answers:

3

Why logs can be sent from dispatchLoopShutdown plugin as it occurs before Zend_Controller_Response_Abstract->sendResponse() and any headers haven't been sent yet ?

I init logger resource in my bootstrap

  protected function _initLogger()
  {
    $writer = new Zend_Log_Writer_Firebug();
    $logger = new Zend_Log($writer);

    Zend_Registry::set('logger', $logger);
    return $logger;
  }

and use it from anywhere

Zend_Registry::get('logger')->debug('test');

and it works up to dispatchLoopShutdown plugin execution point...

+2  A: 

AFAIK the Firebug writer has his own plugin in the dispatchLoopShutdown to inject the data in the response. You should add your plugin with a lower priority (see manual).

DASPRiD
A: 

I'm having the same problem but can't seem to find how to set the priority in the documentation. ANy help is greatly appreciated.

Julian
A: 

Zend_Log_Writer_Firebug itself registers his dispatchLoopShutdown plugin (dLSp for short) during it first run, so to get this logger working in dLSp you need Zend_Log_Writer_Firebug's dLSp (Zend_Wildfire_Channel_HttpHeaders) to be already registered before calling logger in dLSp. You can achieve this for examle by calling $logger->log('') in your bootstrap

HongKilDong