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

Carter Kozak edited comment on HTTPCLIENT-2096 at 7/5/20, 5:46 PM:
-------------------------------------------------------------------

I put together some quick automation using errorprone to make this change: 
https://github.com/apache/httpcomponents-client/pull/236

 If it looks reasonable to you I'll run the automation on httpcomponents-core 
as well.


was (Author: ckozak):
I put together some quick automation using errorprone to make this change: 
[https://github.com/apache/httpcomponents-client/pull/236
]
If it looks reasonable to you I'll run the automation on httpcomponents-core as 
well.

> Consider using static loggers instead of instance loggers
> ---------------------------------------------------------
>
>                 Key: HTTPCLIENT-2096
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2096
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>    Affects Versions: 5.0.1
>            Reporter: Carter Kozak
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> I'd like to consider replacing instance loggers with static loggers to avoid 
> paying a penalty on instantiation. This would result in slightly different 
> (and arguably better) behavior when classes are extended, as the logger 
> origin would reflect the location that produced logging, not the subclass 
> that happened to extend it. For example, if I want to debug hc5, I might set 
> the {{org.apache.hc}} origin to {{TRACE}} level and add it to a separate 
> appender. If I've extended a component it won't appear with my httpclient 
> logs using the {{getClass()}} approach.
> From [~olegk]
> bq. As far as I know static loggers in low level libraries are considered 
> evil and are to be avoided in favor of instance loggers. The overhead of 
> logger instantiation is quite manageable if one injects logger through a 
> constructor of frequently allocated and deallocated components.
> Conversation started here:
> https://github.com/apache/httpcomponents-client/pull/232#discussion_r448963006
> Some existing documentation:
> http://www.slf4j.org/faq.html#declared_static
> https://logging.apache.org/log4j/2.x/manual/usage.html#StaticVsNonStatic



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to