Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware#30539

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromnicolas-grekas:msg-logger
Mar 15, 2019

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedMar 12, 2019
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Discussing with@simensen, we figured out the currently logged messages are not precise enough.
Logging is a cross-cutting concern: splitting it in a dedicated middleware means losing details - or building complexity.
Let's make things simple and log the best messages depending on the internal situation.

While the component is experimental, removing theLoggingMiddleware altogether would break FrameworkBundle 4.2 when it is used with Messenger 4.3. Not worth the trouble when it's two lines to deprecate IMHO.

Copy link
Member

@weaverryanweaverryan left a comment

Choose a reason for hiding this comment

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

Best viewed with?w=1 - looks perfect to me. Much easier to read and now I can see a bit more detail, like when the message is being sent, versus when it is received later and actually handled.

+1

Copy link
Contributor

@ogizanagiogizanagi left a comment

Choose a reason for hiding this comment

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

I'd be +1 for adding these specific log entries in send & handle middleware, but I'm not sure we have to deprecate and unwire the logger middleware from defaults.
It fits its purpose: general debug logs about message lifecycle in the bus and exception, independently of where the exception occurred in the bus (whereas you arbitrary chose to catch in send middleware here). It's also a simple & great showcase on how can be written and used a middleware.

return$stack->next()->handle($envelope,$stack);
}catch (\Throwable$e) {
$context['exception'] =$e;
$this->logger->warning('An exception occurred while handling message "{class}"',$context);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why catching and logging here instead of doing it in the HandleMessageMiddleware?

Also why catching & logging when handling, but not when sending?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Here you are: the try/catch now wraps SendMessageMiddleware
This should address both your questions.

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedMar 13, 2019
edited
Loading

It fits its purpose: general debug logs about message lifecycle in the bus and exception, independently of where the exception occurred in the bus (whereas you arbitrary chose to catch in send middleware here). It's also a simple & great showcase on how can be written and used a middleware.

I 💯 disagree here :) Logging is across-cutting concern. What this means is that it's a bad fit for a middleware. Keeping it as an example of middleware is spreading the idea that logging can be split in its own isolated layer. That's wrong. Because the LoggingMiddleware is a bad fit, its messages are of very low value. I don't want my logs to be filled with many uninformative log lines per messages. Thus the proposal to drop it.

nicolas-grekas added a commit that referenced this pull requestMar 13, 2019
…d (nicolas-grekas)This PR was merged into the 4.3-dev branch.Discussion----------[Messenger] add welcome notice when running the command| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -The current behavior of `./bin/console messenger:consume-messages` is totally silent: you run it and nothing visible happens.Here is what is displayed with this PR:![image](https://user-images.githubusercontent.com/243674/54235039-af0a6c80-4510-11e9-89d8-3c1c55e946c0.png)Combined with#30539, it gives:![image](https://user-images.githubusercontent.com/243674/54235156-ed079080-4510-11e9-9d4d-9f27c87e16e5.png)Commits-------673b58b [Messenger] add welcome notice when running the command
@weaverryan
Copy link
Member

Ping@ogizanagi !

@nicolas-grekasnicolas-grekas merged commit2bff625 intosymfony:masterMar 15, 2019
nicolas-grekas added a commit that referenced this pull requestMar 15, 2019
…oviding a logger to SendMessageMiddleware (nicolas-grekas)This PR was merged into the 4.3-dev branch.Discussion----------[Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Discussing with@simensen, we figured out the currently logged messages are not precise enough.Logging is a cross-cutting concern: splitting it in a dedicated middleware means losing details - or building complexity.Let's make things simple and log the best messages depending on the internal situation.While the component is experimental, removing the `LoggingMiddleware` altogether would break FrameworkBundle 4.2 when it is used with Messenger 4.3. Not worth the trouble when it's two lines to deprecate IMHO.Commits-------2bff625 [Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware
@nicolas-grekasnicolas-grekas deleted the msg-logger branchMarch 15, 2019 13:41
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
@fabpotfabpot mentioned this pull requestMay 9, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@weaverryanweaverryanweaverryan approved these changes

@srozesrozeAwaiting requested review from sroze

+1 more reviewer

@ogizanagiogizanagiogizanagi left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

4 participants

@nicolas-grekas@weaverryan@ogizanagi@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp