logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: AW: Performance and Logger.getLogger()
Date Wed, 02 Apr 2003 14:51:21 GMT
At 04:41 PM 4/2/2003 +0200, you wrote:
>Hey!
>
>Erik:
>
>The FAQ:
>http://jakarta.apache.org/log4j/docs/FAQ.html
>
>
>You are on the right track.
>
>The question is:
>
>{
>         Logger logger = Logger.getLogger("foo.bar");
>
>         logger.warn("");
>         logger.error("");
>
>}(Good)

yes. good.

>vs.
>{
>         Logger.getLogger("foo.bar").warn("");
>         Logger.getLogger("foo.bar").warn("");
>         Logger.getLogger("foo.bar").warn("");
>}(Bad)

yes, bad.

Logger.getLogger("something") will essentially perform a look up on a 
hashtable. I don't think you could improve on this by keeping your own 
hashtable. There are ways where you could potentially improve on the lookup 
performance but this would require a really disproportionate amount of 
effort on your part.


--
Ceki 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message