On Oct 11, 2007, at 4:36 PM, Matthew Kemp wrote:

@Curt

Is the initial call to Logger.getLogger("foo") expensive or is every call to
Logger.getLogger("foo") expensive?


Each call at least involves a Hashtable.get() call which would involve a block on a mutex and hash table lookup. The first call would also have additional overhead for creating and inserting the node in the hierarchy. Depends on the rest of the method if that is proportionately expensive or cheap.

If you have a function that is called frequently and where the log requests do not typically satisfy the threshold, then it could be highly beneficial to get the logger once and use it repeatedly. If you have a function that is not called frequently or where most of the log requests do satisfy the threshold or the method is time consuming, then the proportional cost of the Logger.getLogger() call might be inconsequential.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to