Closed lukaszwit closed 7 years ago
I'm also interested in this.
You may consider a pull request but this project is not actively maintained. Sorry !
Thank you for the reply. For the record I manage to handle the exceptions by extending \Knp\Command\Command and overwrite the run method, adding a try catch, in this way I can log all command executions that somehow failed.
class Command extends \Knp\Command\Command
{
public function run(InputInterface $input, OutputInterface $output)
{
try {
return parent::run($input, $output);
} catch (\Exception $e) {
$this->getSilexApplication()->getLogger()->error($e);
}
}
This will be possible once #31 gets merged (the example I added to the documentation actually shows how to listen to the ConsoleExceptionEvent
and log the error).
In the meantime, something like what @agostlg proposed should also work.
Fixed by #31. You can now register listeners for Symfony\Component\Console\ConsoleEvents
events.
Hi, is there any way to handle "ConsoleExceptionEvent" similar to Symfony commands: http://symfony.com/doc/current/console/logging.html ?