I tried it too, but all the solutions looked too complicated.
.
WebEvent. :
public class SyncError : WebBaseErrorEvent
{
public SyncError(string message, Exception e)
: base(message, "Sync", WebEventCodes.WebExtendedBase + 1, 0, e)
{
}
public override void FormatCustomEventDetails(WebEventFormatter formatter)
{
base.FormatCustomEventDetails(formatter);
formatter.AppendLine(ErrorException.ToString());
}
}
:
public int Sync()
{
try
{
}
catch (Exception ex)
{
var e = new SyncError("Error in Sync", ex);
e.Raise();
throw;
}
}
, web.config:
<eventMappings>
<add name="Sync Errors" type="SyncLibrary.SyncError, SyncLibrary"/>
</eventMappings>
<rules>
<add name="Sync Errors SQL" eventName="Sync Errors"
provider="SqlWebEventProvider"
profile="Default"
minInstances="1"
maxLimit="Infinite"
minInterval="00:00:00" />
</rules>
. , .