Search code examples
symfonysymfony4

Symfony 4, how print logs in profiler log page?


From php files in Symfony 4, how can I print variables (for debug) to the log profiler page ?

I mean this page :

enter image description here

I tried that :

$log = new Logger()
$log->info("test");

$log2 = new ConsoleLogger(OutputInterface::OUTPUT_NORMAL);
$log2->alert("hello !");

But nothing appears...


Solution

  • 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