[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18004954#comment-18004954
 ] 

Oleg Kalnichevski commented on HTTPCLIENT-2371:
-----------------------------------------------

[~davsclaus] 

This change-set  [1] will make both classic and async client transports log 
request re-executions at INFO priority and hopefully should fix the problem you 
have reported. Please do feel free to take a look and let me know if the fix 
looks adequate to you.

{noformat}
2025-07-13 11:04:40,707 INFO  
[main][org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec] 
ex-0000000001 http://localhost:46063 responded with status 503; request will be 
automatically re-executed in 1 SECONDS (exec count 4)
{noformat}

Please note `max retry count` can be strategy specific. It not always fixed and 
may not be known to the request execution pipeline, so it cannot log it. This 
problem can be solved however by adding extra logging by providing a custom 
retry strategy. 

Oleg

[1] https://github.com/apache/httpcomponents-client/pull/674

> http-client - Add option to turn on logging when a HTTP Client is waiting due 
> to 429 Retry-After header
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2371
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2371
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient (classic)
>    Affects Versions: 5.4.4
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 5.5.1
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When you call a remote HTTP service and it returns a HTTP status 429 (too 
> many requests) and that it has a Retry-After header with a value such as 40, 
> then there is no logging activity or something that can show this, and you 
> may think something is wrong or the app is stuck.
> It would be good if there was some option to turn on|off or set a logging 
> level so the 
> HttpRequestRetryExec can show that its waiting
>  
> For example a retryAfterLoggingLevel=INFO
>  
> Then you can make some nice logging that the client is waiting due to 429 and 
> that its waiting for 40 seconds until next attempt, and that you log also the 
> current attempt number, and the Max Retries so you know how many loops there 
> are still etc.
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to