doufu5521 2016-02-10 15:02
浏览 179
已采纳

在Symfony 2中将调试输出打印到浏览器控制台

Could you suggest how to print any debug data into browser console in Symfony 2? Especially, is it possible to implement with Symfony VarDumper Component?
In Zend Framework you can use tool Zend_Log_Writer_Firebug to do so which is very helpful. Does Symfony has something like this from the box?

  • 写回答

1条回答 默认 最新

  • dongzouh51192 2016-02-10 15:36
    关注

    Monolog, the logger used by Symfony, has a built-in support for FirePHP and ChromePHP.

    In Symfony Standard Edition you can configure monolog handlers in your application configuration.

    FirePHP and ChromePHP handlers are even present in config_dev.yml, but are commented out:

    monolog:
        handlers:
            main:
                type: stream
                path: "%kernel.logs_dir%/%kernel.environment%.log"
                level: debug
                channels: [!event]
            console:
                type:   console
                channels: [!event, !doctrine]
            # uncomment to get logging in your browser
            # you may have to allow bigger header sizes in your Web server configuration
            #firephp:
            #    type:   firephp
            #    level:  info
            #chromephp:
            #    type:   chromephp
            #    level:  info
    

    All you need to do to see your logs in the browser is to uncomment the needed handler.

    Currently, the VarDumper component doesn't support dumping anything to the browser's console. However, you can see the dumped values in the web debug toolbar (or in html if you don't use the toolbar).

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

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示