Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 48403 invoked from network); 15 Dec 2004 17:25:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 15 Dec 2004 17:25:15 -0000 Received: (qmail 56184 invoked by uid 500); 15 Dec 2004 17:24:20 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 56133 invoked by uid 500); 15 Dec 2004 17:24:20 -0000 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: "Log4NET User" Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 56096 invoked by uid 99); 15 Dec 2004 17:24:19 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of nicko@neoworks.com designates 80.168.17.114 as permitted sender) Received: from Unknown (HELO kronos.neoworks.co.uk) (80.168.17.114) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 15 Dec 2004 09:23:17 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Make all appenders asynchronous Date: Wed, 15 Dec 2004 17:24:36 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Make all appenders asynchronous Thread-Index: AcTivTb7m88CQo+DTVehVLQmI01LoAAC7V4Q From: "Nicko Cadell" To: "Log4NET User" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Simon,=20 > I've written a couple of custom appenders: one logs events to=20 > a web service and one makes a Remoting call. Both have an=20 > attribute called Async. If set to true in the config file,=20 > the appender will do the work in SendBuffer() or Append()=20 > asynchronously. If set to false it will do it in the normal=20 > synchronous fashion. >=20 > My AsyncRemotingAppender is identical to the RemotingAppender=20 > 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: http://cvs.apache.org/viewcvs.cgi/logging-log4net/src/Appender/RemotingA ppender.cs?rev=3D1.7&view=3Dauto =20 > Is there any interest in modifying appropriate appenders in=20 > the core code to add an Async attribute and the threading=20 > capability? It's not complicated, and am wondering why it's=20 > not in there already. In my performance testing it yields=20 > huge performance gains, especially when combined with buffering. Yes I think that asynchronous support for appenders would be very useful. 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. Cheers, Nicko