[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski resolved HTTPCLIENT-2096.
-------------------------------------------
    Resolution: Fixed

> 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: 2h 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