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?
Asked
Active
Viewed 4,107 times
2

Max Chernopolsky
- 617
- 6
- 17
-
what difference with varDumper in symfony toolbar I don't understand ? – miltone Feb 10 '16 at 15:19
1 Answers
5
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).

Jakub Zalas
- 35,761
- 9
- 93
- 125
-
What do you mean by "Currently, the VarDumper component doesn't support dumping anything to the browser" , it does. – COil Feb 12 '16 at 14:33
-
-
Is there a way to use dump() with this method? It doesn't seems to work in my side, despite var_dumper() works well. – Kr1 Nov 01 '18 at 12:03