I have a console command and I'm initializing ConsoleLogger in the initialize
method:
$this->logger = new ConsoleLogger($output);
But the date is not outputted in the console. Is it possible to prefix the output with the datetime?
I'm not able to post my code as my company will not allow it.
However I ran into this problem and found the only way to solve it was to extend the ConsoleLogger
class and have my overridden log
method prepend the date in the format I wanted before passing it to the parent class using parent::log()
There is no functionality in the ConsoleLogger
class to include the date out of the box.
maybe you need to define the verbosity level
$this->consoleLogger = new ConsoleLogger($output, [LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL]);
Hope this is what you are looking for