I do not reply to myself usually.

2.) Category.callApenders is synchronized on the category object: workaround - create categories with the thread's name as part of their name

Unfortunately 2.) doesn't work when threads with new names are created and destroyed at a high rate like in IBM WebSphere and categories are stored in the log4j-repository forever. At some time all the memory will be used by categories.


The workaround doesn't work at all. Category.callAppenders is also
synchronized on the parent categories. One of them is configured to call
the appender. So all the concurrent threads with their categories
(loggers) have to wait anyway.

I know that the reason for synchronization is this code in
appendLoopOnAppenders which is called from callAppenders:

           size = appenderList.size();
           for (int i = 0; i < size; i++) {
               appender = (Appender) appenderList.elementAt(i);
               appender.doAppend(event);
           }

But why have the readers (every call to log.debug, etc.) of this
appenderList to by synchronized, when there are very rare occurences of
writers (addAppender, removeAppender).

Regards,
Ingo







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



Reply via email to