Skip to content

[Feature][Messenger] Add message in logs #59543

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

Open
AurelienPillevesse opened this issue Jan 17, 2025 · 4 comments
Open

[Feature][Messenger] Add message in logs #59543

AurelienPillevesse opened this issue Jan 17, 2025 · 4 comments

Comments

@AurelienPillevesse
Copy link
Contributor

Description

Currently, when using symfony/messenger, we can not see the message which failed in the logs.

When looking at this :
https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/Messenger/EventListener/SendFailedMessageToFailureTransportListener.php#L61

Or this :
https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php#L73

The message is not added in the log so when we look at logs. We can't see which message with which data have failed.
The idea is to add the message content to debug easily.

Example

No response

@AurelienPillevesse AurelienPillevesse changed the title [Messenger] Adding message in logs [Feature][Messenger] Adding message in logs Jan 17, 2025
@94noni
Copy link
Contributor

94noni commented Jan 17, 2025

I usually store in database the failed message prior to retry, so you end up seeing all data (with the failed transport configured with doctrine)

but here for your issue in raw logs, perhaps adding a logger->debug($message) with the data can be useful indeed, and after let monolog config handle the case that debug log are streamed or not (to not flood logs if unwanted)

or as well mimicking what the workflow component has, a listener to audit that can be activated if needed

@AurelienPillevesse
Copy link
Contributor Author

AurelienPillevesse commented Jan 18, 2025

It only message_id, I would like to have the entire message

With this message :

class MyMessage {
    public function __construct(public int $companyId) {}
}

I would like to see somewhere :

["company_id" => 2]

@AurelienPillevesse AurelienPillevesse changed the title [Feature][Messenger] Adding message in logs [Feature][Messenger] Add message in logs Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants