[GH-ISSUE #668] [FEATURE REQUEST] Customize logging when a task's retries are exhausted #2361

Open
opened 2026-03-15 20:14:34 +03:00 by kerem · 1 comment
Owner

Originally created by @jsmartt on GitHub (Jun 8, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/668

Originally assigned to: @hibiken on GitHub.

Is your feature request related to a problem? Please describe.
I'd like to be able to customize the logging behavior when a task's retries are exhausted.
The log message is not useful to me as-is, and therefore just clutters up my logs.

Describe the solution you'd like
I'd like to be able to specify a function to replace the default behavior defined here which is hardcoded as:

p.logger.Warnf("Retry exhausted for task id=%s", msg.ID)

I want to customize the log message text, but I'd also like to be able to change the log level or even skip logging altogether if I want to, hence providing a function instead of some options or a formatter.

Describe alternatives you've considered
I can't think of any alternatives that meet my needs in a reasonable manor. The only alternative I can think of is to use a custom logger that checks each and every log message to see if it begins with "Retry exhausted for task id=".

Additional context
I don't need to modify the processor's handleFailedMessage logic as a whole; I just want to customize the logging.

Originally created by @jsmartt on GitHub (Jun 8, 2023). Original GitHub issue: https://github.com/hibiken/asynq/issues/668 Originally assigned to: @hibiken on GitHub. **Is your feature request related to a problem? Please describe.** I'd like to be able to customize the logging behavior when a task's retries are exhausted. The log message is not useful to me as-is, and therefore just clutters up my logs. **Describe the solution you'd like** I'd like to be able to specify a function to replace the default behavior defined [here](https://github.com/hibiken/asynq/blob/v0.24.1/processor.go#L334) which is hardcoded as: ```go p.logger.Warnf("Retry exhausted for task id=%s", msg.ID) ``` I want to customize the log message text, but I'd also like to be able to change the log level or even skip logging altogether if I want to, hence providing a function instead of some options or a formatter. **Describe alternatives you've considered** I can't think of any alternatives that meet my needs in a reasonable manor. The only alternative I can think of is to use a custom logger that checks each and every log message to see if it begins with `"Retry exhausted for task id="`. **Additional context** I don't need to modify the processor's `handleFailedMessage` logic as a whole; I just want to customize the logging.
Author
Owner

@safaci2000 commented on GitHub (Sep 30, 2024):

That would be nice! I'd love to be able to have a decaying retry policy.

<!-- gh-comment-id:2383933155 --> @safaci2000 commented on GitHub (Sep 30, 2024): That would be nice! I'd love to be able to have a decaying retry policy.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#2361
No description provided.