You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Vardin. Angel" <a....@seeburger.com> on 2026/01/08 15:48:46 UTC

Request for enhancement of Apache HTTP Client debug logs

Hello,

I enabled the HttpComponents Client 5.5 logs to show DEBUG and TRACE output for the package "org.apache.hc.client5.http.impl.io" in order to get detailed HTTP/1.1 I/O information.

During testing, I noticed that when the log severity is set to DEBUG, many log entries appear that would ideally belong at the TRACE level. For example, the logs were flooded with the following entry, which provides very limited information:

https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java#L606

I also reviewed the codebase and could not find many TRACE-level log statements.

Is there any plan to improve the logging granularity in the future?

Thank you in advance!

Best regards,
Angel


Re: Request for enhancement of Apache HTTP Client debug logs

Posted by "Vardin. Angel" <a....@seeburger.com>.
Hi Oleg,

I checked the provided pull request, and I think it is fine.

Thank you.

Best regards,
Angel



________________________________
From: Oleg Kalnichevski <ol...@apache.org>
Sent: Saturday, January 17, 2026 4:26 PM
To: HttpClient User Discussion <ht...@hc.apache.org>
Subject: Re: Request for enhancement of Apache HTTP Client debug logs

On Tue, 2026-01-13 at 14:49 +0100, Oleg Kalnichevski wrote:
>
>
> On 01/13/2026 14:11, Vardin. Angel wrote:
> > Hello,
> > Thank you for the provided information. My implementation contains
> > logic that cleans expired connections every 10 seconds. To verify
> > the correct timeout value, I checked the default logic in the
> > HttpClientBuilder, which cleans both expired and idle connections.
> > As far as I can see, this is implemented in the
> > IdleConnectionEvictor thread (see links below):
> > https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java#L56
> >
> > https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java#L1118
> > You mentioned in your response that the timeout for expited
> > connections cleaning should not be less than one minute. However,
> > in the IdleConnectionEvictor, the default timeout is 5 seconds if
> > no value is specified. Additionally, if evictIdleConnections is not
> > configured, the timeout defaults seems to be 1 second.
>
> We had extreme cases with people trying to call the damn method every
> few milliseconds. A safe-guard has been introduced to ensure the
> sleep
> interval could not be less than a second. The patch had a bug in it
> that
> I had overlooked. The default should have never been 1 sec.
>
> In the normal course of operations when the pool is reasonably busy
> it
> will evict expired connections as it encounters them. The idle
> evictor
> thread is needed only if there _long_ periods of inactivity. One
> minute
> sweep should be perfectly sufficient, Or 30 seconds. Anything below 5
> seconds is outright crazy but we still allow it in case someone
> really
> has reasons for that.
>
> I will address the problem with IdleConnectionEvictor defaults, but
> there unlikely to be changes to the logging granularity.
>

Hi Angel

Please see the proposed fix

https://github.com/apache/httpcomponents-client/pull/789

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org









SEEBURGER AG            Vorstand/SEEBURGER Executive Board:
Sitz der Gesellschaft/Registered Office:                Axel Haas, Michael Kleeberg, Dr. Martin Kuntz, Matthias Fe?enbecker
Edisonstr. 1
D-75015 Bretten         Vorsitzende des Aufsichtsrats/Chairperson of the SEEBURGER Supervisory Board:
Tel.: 07252 / 96 - 0            Prof. Dr. Simone Zeuchner-Egli
Fax: 07252 / 96 - 2222
Internet: http://www.seeburger.de               Registergericht/Commercial Register:
e-mail: info@seeburger.de               HRB 240708 Mannheim


Dieses E-Mail ist nur f?r den Empf?nger bestimmt, an den es gerichtet ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungs?u?erung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung der SEEBURGER AG dar. Sind Sie nicht der Empf?nger, so haben Sie diese E-Mail irrt?mlich erhalten und jegliche Verwendung, Ver?ffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt. Weder die SEEBURGER AG noch der Absender (Vardin. Angel) ?bernehmen die Haftung f?r Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren Anh?nge auf Viren zu pr?fen.


This email is intended only for the recipient(s) to whom it is addressed. This email may contain confidential material that may be protected by professional secrecy. Any fact or opinion contained, or expression of the material herein, does not necessarily reflect that of SEEBURGER AG. If you are not the addressee or if you have received this email in error, any use, publication or distribution including forwarding, copying or printing is strictly prohibited. Neither SEEBURGER AG, nor the sender (Vardin. Angel) accept liability for viruses; it is your responsibility to check this email and its attachments for viruses.


Re: Request for enhancement of Apache HTTP Client debug logs

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2026-01-13 at 14:49 +0100, Oleg Kalnichevski wrote:
> 
> 
> On 01/13/2026 14:11, Vardin. Angel wrote:
> > Hello,
> > Thank you for the provided information. My implementation contains
> > logic that cleans expired connections every 10 seconds. To verify
> > the correct timeout value, I checked the default logic in the
> > HttpClientBuilder, which cleans both expired and idle connections.
> > As far as I can see, this is implemented in the
> > IdleConnectionEvictor thread (see links below):
> > https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java#L56
> >  
> > https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java#L1118
> > You mentioned in your response that the timeout for expited
> > connections cleaning should not be less than one minute. However,
> > in the IdleConnectionEvictor, the default timeout is 5 seconds if
> > no value is specified. Additionally, if evictIdleConnections is not
> > configured, the timeout defaults seems to be 1 second.
> 
> We had extreme cases with people trying to call the damn method every
> few milliseconds. A safe-guard has been introduced to ensure the
> sleep 
> interval could not be less than a second. The patch had a bug in it
> that 
> I had overlooked. The default should have never been 1 sec.
> 
> In the normal course of operations when the pool is reasonably busy
> it 
> will evict expired connections as it encounters them. The idle
> evictor 
> thread is needed only if there _long_ periods of inactivity. One
> minute 
> sweep should be perfectly sufficient, Or 30 seconds. Anything below 5
> seconds is outright crazy but we still allow it in case someone
> really 
> has reasons for that.
> 
> I will address the problem with IdleConnectionEvictor defaults, but 
> there unlikely to be changes to the logging granularity.
> 

Hi Angel

Please see the proposed fix

https://github.com/apache/httpcomponents-client/pull/789

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Request for enhancement of Apache HTTP Client debug logs

Posted by Oleg Kalnichevski <ol...@apache.org>.

On 01/13/2026 14:11, Vardin. Angel wrote:
> Hello,
> Thank you for the provided information. My implementation contains logic that cleans expired connections every 10 seconds. To verify the correct timeout value, I checked the default logic in the HttpClientBuilder, which cleans both expired and idle connections. As far as I can see, this is implemented in the IdleConnectionEvictor thread (see links below):
> https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java#L56 https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java#L1118
> You mentioned in your response that the timeout for expited connections cleaning should not be less than one minute. However, in the IdleConnectionEvictor, the default timeout is 5 seconds if no value is specified. Additionally, if evictIdleConnections is not configured, the timeout defaults seems to be 1 second.

We had extreme cases with people trying to call the damn method every 
few milliseconds. A safe-guard has been introduced to ensure the sleep 
interval could not be less than a second. The patch had a bug in it that 
I had overlooked. The default should have never been 1 sec.

In the normal course of operations when the pool is reasonably busy it 
will evict expired connections as it encounters them. The idle evictor 
thread is needed only if there _long_ periods of inactivity. One minute 
sweep should be perfectly sufficient, Or 30 seconds. Anything below 5 
seconds is outright crazy but we still allow it in case someone really 
has reasons for that.

I will address the problem with IdleConnectionEvictor defaults, but 
there unlikely to be changes to the logging granularity.

Oleg

> Could you please provide more details on what the timeout value should be?
> Best regards, Angel
> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> Sent: Saturday, January 10, 2026 1:18 PM
> To: HttpClient User Discussion <ht...@hc.apache.org>
> Subject: Re: Request for enhancement of Apache HTTP Client debug logs
> 
> On Thu, 2026-01-08 at 15:48 +0000, Vardin. Angel wrote:
>> Hello,
>>
>> I enabled the HttpComponents Client 5.5 logs to show DEBUG and TRACE
>> output for the package "org.apache.hc.client5.http.impl.io" in order
>> to get detailed HTTP/1.1 I/O information.
>>
>> During testing, I noticed that when the log severity is set to DEBUG,
>> many log entries appear that would ideally belong at the TRACE level.
>> For example, the logs were flooded with the following entry, which
>> provides very limited information:
>>
>> https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java#L606
>>
>> I also reviewed the codebase and could not find many TRACE-level log
>> statements.
>>
>> Is there any plan to improve the logging granularity in the future?
>>
> 
> No, there are no such plans. The verbosity and granularity of logging
> is subjective and we cannot please everyone.
> 
> TRACE priority is not being used mostly because it is not consistently
> supported by all logging frameworks and back-ends.
> 
> Regarding the example referenced above, this is actually a pretty bad
> case because if your code calls #closeExpired method more often than
> once a minute, something is very wrong.
> 
> Oleg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Request for enhancement of Apache HTTP Client debug logs

Posted by "Vardin. Angel" <a....@seeburger.com>.
Hello,
Thank you for the provided information. My implementation contains logic that cleans expired connections every 10 seconds. To verify the correct timeout value, I checked the default logic in the HttpClientBuilder, which cleans both expired and idle connections. As far as I can see, this is implemented in the IdleConnectionEvictor thread (see links below):
https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java#L56 https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java#L1118
You mentioned in your response that the timeout for expited connections cleaning should not be less than one minute. However, in the IdleConnectionEvictor, the default timeout is 5 seconds if no value is specified. Additionally, if evictIdleConnections is not configured, the timeout defaults seems to be 1 second.
Could you please provide more details on what the timeout value should be?
Best regards, Angel

________________________________
From: Oleg Kalnichevski <ol...@apache.org>
Sent: Saturday, January 10, 2026 1:18 PM
To: HttpClient User Discussion <ht...@hc.apache.org>
Subject: Re: Request for enhancement of Apache HTTP Client debug logs

On Thu, 2026-01-08 at 15:48 +0000, Vardin. Angel wrote:
> Hello,
>
> I enabled the HttpComponents Client 5.5 logs to show DEBUG and TRACE
> output for the package "org.apache.hc.client5.http.impl.io" in order
> to get detailed HTTP/1.1 I/O information.
>
> During testing, I noticed that when the log severity is set to DEBUG,
> many log entries appear that would ideally belong at the TRACE level.
> For example, the logs were flooded with the following entry, which
> provides very limited information:
>
> https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java#L606
>
> I also reviewed the codebase and could not find many TRACE-level log
> statements.
>
> Is there any plan to improve the logging granularity in the future?
>

No, there are no such plans. The verbosity and granularity of logging
is subjective and we cannot please everyone.

TRACE priority is not being used mostly because it is not consistently
supported by all logging frameworks and back-ends.

Regarding the example referenced above, this is actually a pretty bad
case because if your code calls #closeExpired method more often than
once a minute, something is very wrong.

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Request for enhancement of Apache HTTP Client debug logs

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2026-01-08 at 15:48 +0000, Vardin. Angel wrote:
> Hello,
> 
> I enabled the HttpComponents Client 5.5 logs to show DEBUG and TRACE
> output for the package "org.apache.hc.client5.http.impl.io" in order
> to get detailed HTTP/1.1 I/O information.
> 
> During testing, I noticed that when the log severity is set to DEBUG,
> many log entries appear that would ideally belong at the TRACE level.
> For example, the logs were flooded with the following entry, which
> provides very limited information:
> 
> https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java#L606
> 
> I also reviewed the codebase and could not find many TRACE-level log
> statements.
> 
> Is there any plan to improve the logging granularity in the future?
> 

No, there are no such plans. The verbosity and granularity of logging
is subjective and we cannot please everyone.

TRACE priority is not being used mostly because it is not consistently
supported by all logging frameworks and back-ends. 

Regarding the example referenced above, this is actually a pretty bad
case because if your code calls #closeExpired method more often than
once a minute, something is very wrong.

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org