Zend Log -坏日志优先级



当我尝试在我的引导中添加registerErrorHandler()到我的日志配置时,它会给出以下错误:

<b>Fatal error</b>:  Uncaught exception 'Zend_Log_Exception' with message 'Bad log priority' in /public/fb/library/Zend/Log.php:280
Stack trace:
#0 /public/fb/application/Bootstrap.php(24):    Zend_Log-&gt;__call('registerErrorHa...', Array)
#1 /public/fb/application/Bootstrap.php(24): Zend_Log-&gt;registerErrorHandler()
#2 /public/fb/library/Zend/Application/Bootstrap/BootstrapAbstract.php(666): Bootstrap-&gt;_initLogging()
#3 /public/fb/library/Zend/Application/Bootstrap/BootstrapAbstract.php(619): Zend_Application_Bootstrap_BootstrapAbstract-&gt;_executeResource('logging')
#4 /public/fb/library/Zend/Application/Bootstrap/BootstrapAbstract.php(583): Zend_Application_Bootstrap_BootstrapAbstract-&gt;_bootstrap(NULL)
#5 /public/fb/library/Zend/Application.php(355): Z in       
<b>/public/fb/library/Zend/Log.php</b> on line    <b>280</b>

Bootstrap.php

protected function _initLogging(){
$log = new Zend_Log();
$writer = new Zend_Log_Writer_Stream(APPLICATION_PATH .'/../data/logs/app.log');
$log->addWriter($writer);
$log->registerErrorHandler();
}

输出Zend_Debug:转储(日志):

object(Zend_Log)#20 (6) {
["_priorities":protected] => array(8) {
[0] => string(5) "EMERG"
[1] => string(5) "ALERT"
[2] => string(4) "CRIT"
[3] => string(3) "ERR"
[4] => string(4) "WARN"
[5] => string(6) "NOTICE"
[6] => string(4) "INFO"
[7] => string(5) "DEBUG"
}
["_writers":protected] => array(1) {
[0] => object(Zend_Log_Writer_Stream)#21 (3) {
["_stream":protected] => resource(59) of type (stream)
["_filters":protected] => array(0) {
}
["_formatter":protected] => object(Zend_Log_Formatter_Simple)#22 (1) {
["_format":protected] => string(51) "%timestamp% %priorityName% (%priority%): %message%"   
}}}
["_filters":protected] => array(0) {
}
["_extras":protected] => array(0) {
}
["_defaultWriterNamespace":protected] => string(15) "Zend_Log_Writer"
["_defaultFilterNamespace":protected] => string(15) "Zend_Log_Filter"
}

谢谢你的帮助

在Zend_Log::__call()魔术方法中抛出错误。由于正在使用__call(),这意味着所引用的方法不显式地存在于对象中,因此PHP调用了对象的__call()魔术方法。

你确定你调用的方法的名字没有错别字吗?

你确定你正在使用的ZF版本实际上支持这种方法吗?我检查了我的ZF安装(1.11.4),在Zend/Log.php文件的第280行,有一些与此问题无关的东西。

更新ZF安装到最新版本可能会有帮助。

相关内容

  • 没有找到相关文章

最新更新