I looked at this a while back and wrote my own web services appender. I first 
wrote it to send a fixed set of log parameters, but then you have a problem if 
you ever write exensions to log4net and your set of parameters changes. You 
would also have to change your web service methods each time. Then I tried to 
send over the log4net event object itself, but ran into serialization issues. 
Maybe others got this to work, but I ended up scrapping this approach.

I found .NET Remoting to be so much easier to deal with. If you have a .NET 
client and .NET server then you can use binary Remoting over TCP (as opposed to 
SOAP), which offers better performance and you don't need to worry about 
serialization. To make it even easier, if you look at the sample code in the 
log4net distribution, you will find a .NET Remoting server and a full example. 
This server also uses log4net, so on the receiving end you use log4net to log 
the events, meaning you can log them to files, databases, or whatever you want. 

I have been using this approach for almost a year now. I have a bunch of 
application servers that use .NET Remoting appenders to log to a centralized 
cluster of "logging servers". These logging servers run the .NET Remoting 
Server (I run it as an NT service), listen on a port for incoming events, and 
when events are received it uses log4net to route the events to final 
destination (usually a database).

I actually wrote my own .NET Remoting appender that would make the calls 
asynchronous, but this was with 1.2.8, and I believe 1.2.9 has asynchronous 
built in with the .NET Remoting appender. I think the only case where you would 
want to use a web service appender instead of Remoting is either when your 
environment is not all .NET-based, or you can only open port 80 on your 
firewall (.NET remoting requires a port other than 80 to be open).

Simon.

-----Original message-----
From: "Billy Barnum" [EMAIL PROTECTED]
Date: Sun, 15 Jan 2006 23:30:18 -0800
To: [email protected]
Subject: Is there anything resembling a "WebServicesAppender"?

> I've gotten pretty familiar with the file, smtp, adonet, and eventlog
> appenders, and have even written my own simple extensions. Now I'm being
> asked to make log4net logging happen over the public internet from a .NET
> Winforms client app, and I'm on unfamiliar ground.
> 
> The client is a .NET Winforms app that will do some work locally and hit up
> servers over http via .NET web services for other work, but log entries must
> be made to the central servers. My customer doesn't want to log locally and
> then have users email local logs; they want to see errors and info entries
> as they happen, or pretty soon thereafter. Ultimately, log entries are to be
> written to NTFS files a la FileAppender.
> 
> I'm talking about something resembling a "Web Services Appender", methinks.
> 
> Is there some relatively easy way to achieve this with RemotingAppender and
> an almost-empty server host in IIS that just passes everything through via a
> server-side log4net config file that names a FileAppender? Or is there
> another, better approach?
> 
> I'm looking for general advice, samples, links to other resources - anything
> at all. Grateful for whatever tidbits I can get that don't take up too much
> of folks' time. Thanks in advance.
> 
> -BillyB
> 

Reply via email to