We have a Webservice that has been logging Elmah
errors as XML
files into a folder. This webservice application has pure ASMX
webservices and ASPX
webservices.
We now have a requirement to log these errors to different folders based on whether the error is occurring in the pure ASMX
webservices or the ASPX
webservices. The ASMX
webservices log errors using a SoapExtension
whereas the ASPX
webservices log errors using custom error logging.
Is logging to different folders supported in Elmah?
Global.asax.cs
protected void Application_BeginRequest(Object sender, EventArgs e)
{
var xmlFileErrorLog = (XmlFileErrorLog)ErrorLog.GetDefault(HttpContext.Current);
elmahLogPathField.SetValue(xmlFileErrorLog, elmahDirectory);
}
protected void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
if (loggingEnabledDocumentManagement == "0")
{
e.Dismiss();
return;
}
}