using this project from non-ASP.Net applications

May 14, 2010 at 10:40 AM
I'd like to use this nice project from few different types of applications we're currently maintaining and developing to centralize exception logging. The only problem is the applications are quite heterogeneous - some of them are WCF services, some are command line tools and some are even WPF clients (for the WCF services) running on remote client machines. I just read the PDF guide and thought about making use of the folder containng XML files with logged exceptions for this purpose. That means I'd just make some web service frontend to upload generated XML files containing exceptions to this folder. Uploaded files should be than processed by a agent into ELMAH DB if I understand it correctly. Or is it possible to use ELMAH Web Service directly for this purpose? We're using log4net currently in all of the applications I'd like to use ELMAH with so my current idea was to develop a log4net appender which could be simply configured to pass errors to the ELMAH web service (or our own web service frontend for this project if ELMAH web service is not usable for this purpose). Is this idea viable?
May 17, 2010 at 9:00 AM
Your idea is certainly viable. To get Elmah logging for WCF services please take a look at this question on stackoverflow: For windows applications you could do it like this: Using the XmlFileErrorLog class from Elmah you can save the error xml files to the correct directory. After that they will be picked up by the Agent and sent to te web service for processing.
May 17, 2010 at 9:12 AM
Thanks for your feedback. What about using the Elmah web service (OrbitOne.Elmah.WebService.dll > Service.LogError()) directly from all the applications - is it good idea? I find it more comfortable than developing some other web service which would create the XML files in agents directory..
May 17, 2010 at 10:06 AM
It's certainly possible, but there are two downsides: 1) You will need to create the XML anyway. The LogError method on the web service takes the error xml as a parameter. 2) When there is no connection to the web service for some reason (webservice is down, dns error, network error, ...) the exception can not be logged. The Agent was developed to solve this problem.
May 17, 2010 at 10:11 AM
You're right in both cases. I already use Elmah.Error.ToXml() to generate the XML contents, but the second issue with WS availability is surely possible...
Nov 6, 2013 at 11:04 AM
any updates using VS 2013 for WCF, Winforms, WPF, MVC applications ?