Skip to content
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

[Console] Update the doc for automatic console logging #7373

Merged
merged 1 commit into from Feb 3, 2017

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Jan 16, 2017

In symfony/symfony#21003 we are going to provide automatic error/exception logging for the console, similar to what is done in an HTTP context.

In the docs, there is a whole chapter dedicated to this topic. Right now I just removed it, maybe it should be done differently or mentioned somewhere that error/exceptions are automatically logged on the console channel?

Thanks

@javiereguiluz
Copy link
Member

Yes, we should remove the contents of this article ... but maybe it's too son to remove the article itself. Otherwise, all the .../current/console/logging.html links will break. What if we just add the following content to the article:

In Symfony versions prior to 3.3, the Console component didn't provide any
logging capabilities out of the box and you had to implement your own exception
lister for the console.

Starting from Symfony 3.3, the Console component provides automatic error and
exception logging. <Here a link to read more details about enabling/configuring this>

@chalasr
Copy link
Member Author

chalasr commented Jan 17, 2017

@javiereguiluz Let's do it like that 👍
However, I have no idea of where should lead the "read more" link you mentioned (nor what it should contain) :/
It is not planed to make this feature opt-in (AFAIK it is not for exception logging in HTTP context), exceptions will be logged as any other.
Maybe could we add it this link at first, and see for a more detailed reading if the feature becomes configurable?

@javiereguiluz
Copy link
Member

@chalasr then we can remove the link entirely and add it later if needed:

In Symfony versions prior to 3.3, the Console component didn't provide any
logging capabilities out of the box and you had to implement your own exception
lister for the console.

Starting from Symfony 3.3, the Console component provides automatic error and
exception logging.

@chalasr
Copy link
Member Author

chalasr commented Jan 17, 2017

Oops, that's what I meant, but forgot "without" in my last sentence :) I made the change

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

👍

@chalasr
Copy link
Member Author

chalasr commented Jan 18, 2017

I re-added the page title so that other pages can have links to, the travis build was failing if missing.

symfony-splitter pushed a commit to symfony/console that referenced this pull request Jan 23, 2017
…eshalsall, 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        | symfony/symfony-docs#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
fabpot added a commit to symfony/symfony that referenced this pull request Jan 23, 2017
…eshalsall, 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        | symfony/symfony-docs#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
-------

919041c Add Console ExceptionListener
9896547 Add basic support for automatic console exception logging
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Jan 23, 2017
…eshalsall, 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        | symfony/symfony-docs#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
@chalasr chalasr changed the title [WCM][Console] Update the doc for automatic console logging [Console] Update the doc for automatic console logging Jan 24, 2017
@chalasr
Copy link
Member Author

chalasr commented Jan 24, 2017

symfony/symfony#21003 has been merged, this is no longer on hold.

@xabbuh
Copy link
Member

xabbuh commented Feb 3, 2017

Thank you @chalasr.

@xabbuh xabbuh merged commit 76d2c91 into symfony:master Feb 3, 2017
xabbuh added a commit that referenced this pull request Feb 3, 2017
…(chalasr)

This PR was merged into the master branch.

Discussion
----------

[Console] Update the doc for automatic console logging

In symfony/symfony#21003 we are going to provide automatic error/exception logging for the console, similar to what is done in an HTTP context.

In the docs, there is a whole chapter dedicated to this topic. Right now I just removed it, maybe it should be done differently or mentioned somewhere that error/exceptions are automatically logged on the `console` channel?

Thanks

Commits
-------

76d2c91 Update the doc for automatic console logging
xabbuh added a commit that referenced this pull request Feb 3, 2017
@chalasr chalasr deleted the 3.3/console-logging branch February 3, 2017 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants