> After taking a cursory look at the code I would suggest 
> to stick with NOPLog and Log4jCategoryLog. Moreover, you 
> probably want to delegate the category look up to log4j 
> instead of maintaining your own hashtable/hashmap. Not 
> only will this be faster but also safer.  Just my 2c, Ceki

Thanks Ceki.

The second suggestion follows from the first.  As long as SimpleLog exists,
there is some need for the cache of logs in LogSource, otherwise you'll get
a distinct instance of SimpleLog, even if it has the same name/category.
(Well, that's not a critical problem, but it seems less efficient,
especially if we were to add synchronization per log category.) Not caching
the log instances would exchange memory for a little bit of time, but I'm
assuming clients will maintain a static or instance variable referencing the
Log instance and hence the makeNewLogInstance would be invoked quite rarely.

I'm not sure what you mean by "safer", but I you're more in tune with the
way log4j operates than I am.  Would it make sense to not cache the logs
that are instances of Log4JCategoryLog?  What's not safe about the
alternative?  I typically store a static final reference to the log4j
Category anyway and that would seem to be more or less equivalent.  Is there
some danger in that practice I'm not seeing?

Reply via email to