Reputation: 2406
From php files in Symfony 4, how can I print variables (for debug) to the log profiler page ?
I mean this page :
I tried that :
$log = new Logger()
$log->info("test");
$log2 = new ConsoleLogger(OutputInterface::OUTPUT_NORMAL);
$log2->alert("hello !");
But nothing appears...
Upvotes: 2
Views: 2626
Reputation: 51
You may not have installed the monolog bundle. Without that you get a very rudimentary logging.
Run:
composer require symfony/monolog-bundle
Reload app and see if message start appearing in the log tab of the profiler.
Upvotes: 3
Reputation: 2406
I just follow the monolog symfony guide : http://symfony.com/doc/current/logging.html
After logger install, I add somewhere in a controller a "$logger->info("foo");" and I see the trace from the log profiler page
Upvotes: 0