I've recently gone from using Symfony 2.7 to 4.2.
Previously in my commands in order to log to a file I used something like:
$logger = $this->getContainer()->get('logger');
$logger->error('put this in log');
This functionality appears to have changed. I can log from a controller following https://symfony.com/doc/current/logging.html
I can output to the console using:
$logger = new ConsoleLogger($output);
$logger->log('error','Put this in the log file');
But as much as I stare at the information on the symfony website I just can't figure out how to log to a file using symfony 4.2 from a command.