private void btnClick_Open(object sender, RoutedEventArgs e)
{
try
{
//Code.......
}
catch(Exception ex)
{
//Calling exception logging from catch block.
webService.LogExceptionAsync(ex.message);
webService.LogExceptionCompleted+=new EventHandler
}
}
public void webService_LogExceptionCompleted(object sender, LogExceptionCompletedEventArgs e)
{
e.Handle = true;
}
Is this the proper way to log an exception or is there another standerd way to log an erros..?

Hemant KumarPosted Jul 10, 2012, 2:02 AM
I think the best option to store the Log Errors is in a File or XML file rather than the Web Service.
Refer this link
http://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET
Uday GaikwadPosted Jun 28, 2010, 6:55 AM
I am using the same freesource API Log4Net for exception logging.
I have deploy the webservice and in web service i have implemented the log4Net and all logs i am storing on physical location of server on C:\ drive.
But my question is that i am trying to log the exception on silverlight application that executes and perform the operation on client side only......If any error occur at client side that error i want to log.......so I am calling LogExcepion method of WCF from catch block of silverlight application........Is this the correct way.! or we can go with the different solution.
Mahesh ChandPosted Jun 27, 2010, 9:36 AM
I would log exceptions on local machine either in a local database or text or XML files.
Log4Net is one of the best open source API to implement logging in your applications.