0

I have implemented a console exception listener exactly as explained in http://symfony.com/doc/current/cookbook/console/logging.html#enabling-automatic-exceptions-logging it works as expected.

But I have some cronjobs that execute some commands that require arguments and options and I would like to add this arguments and options to my log, to have a more specific detail of what caused an error.

How can I do that? Inside the command class I haven't see a public function to get the arguments or options

felipep
  • 2,442
  • 1
  • 28
  • 35

1 Answers1

0

I found the answer I was looking in the wrong place

$command = $event->getCommand();

As described in the question Command has no methods to get it

but

ConsoleExceptionEvent $event

has a method to get the input (Arguments and Options)

$event->getInput();
felipep
  • 2,442
  • 1
  • 28
  • 35