Hi,

I want to write a multithreaded appender. Threads that use this appender shouldn't be synchronized because writing can take some time and their back end takes care of synchronization (database or MQ-Series). On the other hand the appender must notify their caller if something goes wrong, for instance with RuntimeExceptions. So using the AsyncAppender isn't an option.

My problem is that the "way" from Logger.info() to Appender.append() is synchronized on two locations. Therefore every (potentially parallel) call to the Appender is synchronized.

1.) AppenderSkeleton.doAppend is synchronized on the appender object: workaround - write a new "UnsynchronizedAppenderSkeleton" and derive from this class
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.

Questions:
1.) Are my observations and conclusions right?
2.) Is there a workaround?

Regards,
Ingo







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



Reply via email to