-
Notifications
You must be signed in to change notification settings - Fork 150
Description
I am trying to use this sink with AuditTo but under heavy load I get errors
System.AggregateException: Failed to emit a log event. (Connection cannot be changed while async operation is in progress.)
This happens from within my logging call in audit.Save()
`
public void Log(string eventType, IDictionary<string, object> customFields = null, string comments = null)
{
using (var audit = auditScopeFactory.Create(new AuditScopeOptions { CreationPolicy = EventCreationPolicy.Manual }))
{
LogInternal(audit, eventType, customFields, comments);
audit.Save();
}
}
`
I think the issue arises because the underlying database connection is being reused inside Serilog and my Log function is called from a thread other than the main thread.
Can anyone confirm this or possibly suggest a fix?