File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 119119/cookbook/console/commands_as_services /console/commands_as_services
120120/cookbook/console/console_command /console
121121/cookbook/console/index /console
122- /cookbook/console/logging /console/logging
122+ /cookbook/console/logging /console
123123/cookbook/console/request_context /console/request_context
124124/cookbook/console/style /console/style
125125/cookbook/console/usage /console
402402/components/weblink /components/web_link
403403/frontend/encore/installation-no-flex /frontend/encore/installation
404404/http_cache/form_csrf_caching /security/csrf
405+ /console/logging /console
Original file line number Diff line number Diff line change @@ -114,6 +114,8 @@ Listeners receive a
114114 $event->setError(new \LogicException('Caught exception', $exitCode, $event->getError()));
115115 });
116116
117+ .. _console-events-terminate :
118+
117119The ``ConsoleEvents::TERMINATE `` Event
118120--------------------------------------
119121
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ want a command to create a user::
3737 {
3838 // the name of the command (the part after "bin/console")
3939 protected static $defaultName = 'app:create-user';
40-
40+
4141 protected function configure()
4242 {
4343 // ...
@@ -373,6 +373,15 @@ console::
373373 :class: `Symfony\\ Component\\ Console\\ Application <Symfony\\ Component\\ Console\\ Application> `
374374 and extend the normal ``\PHPUnit\Framework\TestCase ``.
375375
376+ Logging Command Errors
377+ ----------------------
378+
379+ Whenever an exception is thrown while running commands, Symfony adds a log
380+ message for it including the entire failing command. In addition, Symfony
381+ registers an :doc: `event subscriber </event_dispatcher >` to listen to the
382+ :ref: `ConsoleEvents::TERMINATE event <console-events-terminate >` and adds a log
383+ message whenever a command doesn't finish with the ``0 `` exit status.
384+
376385Learn More
377386----------
378387
Original file line number Diff line number Diff line change @@ -338,9 +338,10 @@ dealing with the ``TransformerInterface``.
338338
339339.. tip ::
340340
341- As long as there is only one class implementing the interface and that class
342- is part of the same namespace configuring the alias is not mandatory and Symfony
343- will automatically create one.
341+ When using a `service definition prototype `_, if only one service is
342+ discovered that implements an interface, and that interface is also
343+ discovered at the same time, configuring the alias is not mandatory
344+ and Symfony will automatically create one.
344345
345346Dealing with Multiple Implementations of the Same Type
346347------------------------------------------------------
@@ -500,3 +501,4 @@ Public bundles should explicitly configure their services and not rely on autowi
500501
501502.. _Rapid Application Development : https://en.wikipedia.org/wiki/Rapid_application_development
502503.. _ROT13 : https://en.wikipedia.org/wiki/ROT13
504+ .. _service definition prototype : https://symfony.com/blog/new-in-symfony-3-3-psr-4-based-service-discovery
You can’t perform that action at this time.
0 commit comments