This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Console
Fabien Potencier c2a6ddc0ea feature #21003 [Console][FrameworkBundle] Log console exceptions (jameshalsall, chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Console][FrameworkBundle] Log console exceptions

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10895
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/7373

Continues #19382, fixing some issues including:
- ability to display the input string for any `InputInterface` implementation (cast to string if possible, use the command name otherwise)
- if the input can be casted as string, cleanup the result (from `command "'command:name' --foo=bar" ` to `command "command:name --foo=bar"`)
- made `ExceptionLister::$logger` private instead of protected
-  changed methods name from `onKernel*` to `onConsole*` (e.g. `onConsoleException`) and removed unnecessary doc blocks
- Added more tests

Log for an exception:

> [2016-12-22 00:34:42] app.ERROR: Exception thrown while running command: "cache:clear -vvv". Message: "An error occured!" {"exception":"[object] (RuntimeException(code: 0): An error occured! at /Volumes/HD/Sites/tests/sf-demo-3.2/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:61)","command":"cache:clear -vvv","message":"An error occured!"} []

Commits
-------

919041c1ad Add Console ExceptionListener
9896547a4d Add basic support for automatic console exception logging
2017-01-23 14:46:36 -08:00
..
Command Merge branch '3.1' into 3.2 2017-01-02 15:57:35 +01:00
DependencyInjection Move AddConsoleCommandPass from FrameworkBundle to Console. 2017-01-11 13:05:48 +01:00
Descriptor feature #21075 [Console] Show hidden commands in json & xml descriptors (ogizanagi) 2017-01-04 06:29:21 -08:00
Event fixes CS 2015-08-24 09:13:45 +02:00
EventListener Add Console ExceptionListener 2017-01-23 23:15:00 +01:00
Exception [Console] Fix infinite loop on missing input 2016-11-03 09:51:57 +01:00
Formatter Merge branch '3.1' into 3.2 2016-12-27 11:44:30 +01:00
Helper Merge branch '3.2' 2017-01-02 15:58:37 +01:00
Input Merge branch '3.1' 2016-10-06 10:59:27 +02:00
Logger Merge branch '3.1' 2016-11-16 17:18:16 -05:00
Output Merge branch '2.8' into 3.1 2016-08-19 08:48:39 +02:00
Question Merge branch '2.8' into 3.1 2016-12-27 11:43:25 +01:00
Resources/bin Move hiddeninput.exe to Resources/bin 2012-10-16 11:08:11 +02:00
Style [Console] Ease writing to stderr using styles 2017-01-06 19:34:44 +01:00
Tester fixed CS 2017-01-21 09:18:54 -08:00
Tests feature #21003 [Console][FrameworkBundle] Log console exceptions (jameshalsall, chalasr) 2017-01-23 14:46:36 -08:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
Application.php Merge branch '3.2' 2016-12-27 11:45:09 +01:00
CHANGELOG.md Add Console ExceptionListener 2017-01-23 23:15:00 +01:00
composer.json Move AddConsoleCommandPass from FrameworkBundle to Console. 2017-01-11 13:05:48 +01:00
ConsoleEvents.php move event listener method type hint docs to @Event annotations default value. makes it easily parsable by PhpStorm plugin 2016-05-03 20:48:46 +02:00
LICENSE updated LICENSE year 2017-01-02 12:30:00 -08:00
phpunit.xml.dist use the clock mock for progress indicator tests 2016-03-17 10:19:04 +01:00
README.md Updated all the README files 2016-03-04 08:12:06 +01:00
Terminal.php [Console] Fix return type in Terminal docblocks 2017-01-04 17:48:15 +00:00

Console Component

The Console component eases the creation of beautiful and testable command line interfaces.

Resources

Credits

Resources/bin/hiddeninput.exe is a third party binary provided within this component. Find sources and license at https://github.com/Seldaek/hidden-input.