为什么 Zend_Log_Writer_Firebug 无法记录来自dispatchLoopShutdown 插件的消息?
为什么日志可以从dispatchLoopShutdown插件发送,因为它发生在Zend_Controller_Response_Abstract->sendResponse()之前并且任何标头尚未发送?
我在引导程序中初始化记录器资源
protected function _initLogger()
{
$writer = new Zend_Log_Writer_Firebug();
$logger = new Zend_Log($writer);
Zend_Registry::set('logger', $logger);
return $logger;
}
并从任何地方使用它
Zend_Registry::get('logger')->debug('test');
,它可以工作到dispatchLoopShutdown插件执行点...
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AFAIK Firebug 作者在dispatchLoopShutdown 中有他自己的插件,用于在响应中注入数据。您应该添加具有较低优先级的插件(请参阅手册)。
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
本身会在第一次运行时注册他的dispatchLoopShutdown
插件(简称dLSp
),以便让这个记录器在dLSp
中工作code> 在调用dLSp
中的记录器之前,您需要先注册Zend_Log_Writer_Firebug
的dLSp
(Zend_Wildfire_Channel_HttpHeaders
)。例如,您可以通过在引导程序中调用$logger->log('')
来实现此目的Zend_Log_Writer_Firebug
itself registers hisdispatchLoopShutdown
plugin (dLSp
for short) during it first run, so to get this logger working indLSp
you needZend_Log_Writer_Firebug
'sdLSp
(Zend_Wildfire_Channel_HttpHeaders
) to be already registered before calling logger indLSp
. You can achieve this for examle by calling$logger->log('')
in your bootstrap