8000 [WIP] [Console] Add basic support for automatic console exception logging by jameshalsall · Pull Request #19382 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WIP] [Console] Add basic support for automatic console exception logging #19382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unnecessary exit code handling in ExceptionListener
  • Loading branch information
jameshalsall authored and James Halsall committed Aug 17, 2016
commit 0961f8cfc881364170a02b2ec354c89bea458736
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* Attempts to log exceptions or abnormal terminations of console commands.
*
* @author James Halsall <james.t.halsall@googlemail.com>
* @author James Halsall <james.t.halsall@googlemail.com>
*/
class ExceptionListener implements EventSubscriberInterface
{
Expand Down Expand Up @@ -62,10 +62,6 @@ public function onKernelTerminate(ConsoleTerminateEvent $event)
return;
}

if ($exitCode > 255) {
$event->setExitCode(255);
}

$message = sprintf('Command `%s` exited with status code %d');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks something else than what the title of this PR suggests. moreover, I'm not sure it's forth logging a non zero status code: it's the command's responsibility to know if it's worth logging of not, don't you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of this PR is to add automatic exception logging "out of the box" with zero configuration. Maybe I'm misunderstanding but surely anything other than a 0 exit code would result in some kind of log entry, unless there's a fatal PHP error before Symfony kernel bootstraps

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. something is missing in the sprintf
  2. I would add the current argument/options

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated


$this->logger->warning($message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put error.

Expand Down
0