开发者

Why Zend_Log_Writer_Firebug can't log messages from dispatchLoopShutdown plugin?

开发者 https://www.devze.com 2023-01-13 19:26 出处:网络
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 ?

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

Zen开发者_Python百科d_Registry::get('logger')->debug('test');

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


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).


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号