logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Make all appenders asynchronous
Date Wed, 15 Dec 2004 17:24:36 GMT

> I've written a couple of custom appenders: one logs events to 
> a web service and one makes a Remoting call. Both have an 
> attribute called Async. If set to true in the config file, 
> the appender will do the work in SendBuffer() or Append() 
> asynchronously. If set to false it will do it in the normal 
> synchronous fashion.
> My AsyncRemotingAppender is identical to the RemotingAppender 
> except for a bit of extra code to do the threading.

We have had to make the RemotingAppender asynchronous to fix an issue
with CallContext data being both propagated and also being lost. The
latest version is here:

> Is there any interest in modifying appropriate appenders in 
> the core code to add an Async attribute and the threading 
> capability? It's not complicated, and am wondering why it's 
> not in there already. In my performance testing it yields 
> huge performance gains, especially when combined with buffering.

Yes I think that asynchronous support for appenders would be very
An alternative to modifying all the appenders to support both
synchronous and asynchronous logging would be to have a generic
AsyncForwardingAppender that forwards the events to the actual appender
that sends the event.

This would work along the lines of the ForwardingAppender which forwards
events to several attached appenders or the BufferingForwardingAppender
which buffers events and then forwards them to appenders. The
AsyncForwardingAppender would just have to Fix the LoggingEvent and then
forward it on to the attached appenders from a separate thread. Of
course care needs to be taken to ensure that slow or stalled appenders
don't block delivery of events to other appenders, while ensuring that
the appender doesn't use too many threads.



View raw message