doumen6532 2011-08-17 16:26
浏览 57
已采纳

与Zend_Log_Writer_Firebug一起使用时,FirePHP不显示额外内容

I've been developing with Zend Framework for ages (since 0.9) and this problem is nagging at my nerves ever since.

I want to output messages on the FireBug Console with the help of FirePHP and from a Zend Framework 1.11 Application. I've configured Firebug with the default application.ini-file:

resources.log.firebug.writerName = "Firebug"
resources.log.firebug.filterName = "Priority"
resources.log.firebug.filterParams.priority = 7

I can now see messages in FireBug, e.g. in the IndexController, by calling an invalid action or by explicitly throwing Exceptions like

throw new Exception("This is my error message", E_USER_ERROR);

This results in the default ErrorController handling the Exception and showing a stack trace and request parameters:

Request Parameters

The default ErrorController will also log all messages automatically to FireBug:

Firebug Success

However, as you can see, the extra-information like the stack trace or the request parameters are not shown, although FireBug is quite able to do so, as may be seen in this Screenshot of FireBug when visiting the mainpage:

Detailed Firebug window

As the documentation states, Zend_Log_Writer_Firebug will ignore all writerParams, with which a defaultPriorityStyle may be set to TRACE or something similar.

Now for my question: Is there any way to configure Zend Framework to also send over the extra data (as shown in the last picture) without having to use firePHPcore, but with the tools coming with Zend Framework itself?

Best Regards and Thanks in Advance!

  • 写回答

1条回答 默认 最新

  • dongshungou7699 2011-08-19 00:14
    关注

    I think you cannot achieve what you're saying with the default error controller generated from zf create project because the lines involved are these

    // Log exception, if logger available
    if ($log = $this->getLog()) {
        $log->log($this->view->message, $priority, $errors->exception);
        $log->log('Request Parameters', $priority, $errors->request->getParams());
    }
    

    i.e. the default error controller only log the message, the priority and the exception and the firebug writer format them in the way you shown.

    To achieve what you're saying you should hack the Zend_Log_Writer_Firebug class to display the stacktrace using the firebug console or alternatively you can play with a custom formatter class added to your logger.

    I did something similar by creating a mail logger which displays formatted exception stacktrace in a mail message and use when in production to obtain a formatted log of the exception sent by email. You can find it here on Github and here you can find its usage.

    Moreover you can see an example on how to use the firebug console using the ZF classes in the Zend_Db_Profiler_Firebug class.

    So to answer your question, no you can't do that without writing some custom class and it as writer or formatter to the log object nor you can do that by just using the application.ini file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记