-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
jameshalsall
wants to merge
15
commits into
symfony:master
from
jameshalsall:automatic-console-exception-logging
Closed
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4284161
Add basic support for automatic console exception logging
jameshalsall 17ef8db
Fix coding standards
jameshalsall 3d6b22b
Simplify the log entry for console exceptions
jameshalsall 0961f8c
Remove unnecessary exit code handling in ExceptionListener
jameshalsall 5bd799e
Fix onKernelTerminate message logging
jameshalsall 80c3ac3
Fix coding style
jameshalsall f7a7048
Fix code style
c21d206
Fix code style, add TODO
2874431
Update console error log with placeholders and context
bcbc8cb
Replace global usage with ArgvInput
da278e6
Remove backticks around command name in log message
jameshalsall 44a0822
Add test for onKernelTerminate
jameshalsall 5dc8b61
Update console ExceptionListener messaging, add test
jameshalsall b196557
Add tests for onKernelTerminate, fix log message
jameshalsall e6c4994
Revert change to composer.json
jameshalsall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove unnecessary exit code handling in ExceptionListener
- Loading branch information
commit 0961f8cfc881364170a02b2ec354c89bea458736
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
{ | ||
|
@@ -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'); | ||
|
||
$this->logger->warning($message); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put |
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated