How can I get the symfony log from the controller?

How can I get the current log file on a symfony controller?

I know that I can do it like this:

$logFile = $this->container->getParameter('kernel.root_dir') . "/logs/" . 
               $this->container->get('kernel')->getEnvironment() . ".log";

but this fails if the log dir parameter is configured. So I thought there should be a more direct way to get it. Is there any parameter that contains the current log file?

Related question: where can I get a list of all container parameters?

+4
source share
2 answers

For a list of options, use the symfony console:

For symfony 2.6 (maybe 2.7)

app/console debug:container --parameters

For 2.3

app/console container:debug --parameters

EDIT NEXT DISC

The log disk is stored in kernel parameters. You can access this:

$container->get('kernel')->getLogDir();
+7
source

Sf. 2.6: ( )

 bin/console debug:container --parameters
0

All Articles