On Fri, 04 Nov 2005 00:55:22 -0500, Frank W. Zammetti wrote:

> One thing that I'm curious about... are you actually instantiating a new 
> Logger on each class instantiation (in the constructor I would guess)? 
> If so, you might want to try making it a static member so the Logger 
> instantiation doesn't happen with each class instantiation.  This is 
> described in the Log4J docs (I believe it's kind of the normal, accepted 
> way), and it's how I've personally always done it.  It may make no 
> difference at all, but I don't know what the overhead of that 
> getLogger() call is, might be interesting to avoid it and see if there 
> is any difference.

I started out assigning logger at object construction time because some of
the classes get inherited and I wanted the logger to reflect the actual
class of the current object.  I also am using MDC to hold a session/thread
marker and set that in the factory that gets called in the logger factory.
I think those issues may not matter for classes that don't get inherited,
so I'll probably make the logger field static final in those classes.

-- 
Mac :})
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.



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

Reply via email to