internal static void LogErrorProcessingMailboxEvent(string assistantName, MailboxData mailbox, Exception e, string databaseName = "", string jobId = "", MailboxSlaRequestType requestType = MailboxSlaRequestType.Unknown) { string value = string.Empty; string value2 = "unknown"; string value3 = "unknown"; Guid guid = Guid.Empty; string value4 = string.Empty; string value5 = (e.InnerException != null) ? e.InnerException.GetType().ToString() : "null"; string diagnosticContext = AssistantsLog.GetDiagnosticContext(e); Guid activityId = (ActivityContext.ActivityId != null) ? ActivityContext.ActivityId.Value : Guid.Empty; if (mailbox != null) { value3 = mailbox.DatabaseGuid.ToString(); StoreMailboxData storeMailboxData = mailbox as StoreMailboxData; if (storeMailboxData != null) { value2 = "Store"; guid = storeMailboxData.Guid; if (storeMailboxData.OrganizationId != null) { value = storeMailboxData.OrganizationId.ToString(); } } else { AdminRpcMailboxData adminRpcMailboxData = mailbox as AdminRpcMailboxData; if (adminRpcMailboxData != null) { value2 = "AdminRpc"; value4 = adminRpcMailboxData.MailboxNumber.ToString(CultureInfo.InvariantCulture); } } } List <KeyValuePair <string, object> > customData = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("MailboxType", value2), new KeyValuePair <string, object>("MailboxGuid", guid), new KeyValuePair <string, object>("MailboxId", value4), new KeyValuePair <string, object>("TenantId", value), new KeyValuePair <string, object>("Database", value3), new KeyValuePair <string, object>("ExceptionType", e.GetType().ToString()), new KeyValuePair <string, object>("InnerExceptionType", value5), new KeyValuePair <string, object>("DiagnosticContext", diagnosticContext) }; AssistantsLog.InternalLogRow(activityId, assistantName, null, AssistantsEventType.ErrorProcessingMailbox, customData, guid); if (!string.IsNullOrEmpty(assistantName)) { MailboxAssistantsSlaReportLogFactory.MailboxAssistantsSlaReportLog logInstance = MailboxAssistantsSlaReportLogFactory.GetLogInstance(assistantName, SlaLogType.MailboxSlaLog); if (logInstance != null) { logInstance.LogMailboxEvent(assistantName, databaseName, jobId, requestType, guid, (mailbox == null) ? string.Empty : mailbox.DisplayName, MailboxSlaEventType.ErrorProcessingMailbox, MailboxSlaFilterReasonType.None, e); } } }
internal static void LogEndGetMailboxesEvent(Guid activityId, string assistantName, int numberOfMailboxesToProcess, AssistantBase assistant) { List <KeyValuePair <string, object> > customData = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("MailboxesToProcess", numberOfMailboxesToProcess) }; AssistantsLog.InternalLogRow(activityId, assistantName, null, AssistantsEventType.EndGetMailboxes, customData, Guid.Empty); AssistantsLog.LogDatabaseSlaEvent(assistant, DatabaseSlaEventType.EndMailboxTableQuery, null); }
internal static void LogMailboxFilteredEvent(Guid activityId, string assistantName, AssistantBase assistant, string reason, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage, MailboxSlaFilterReasonType filterReason) { List <KeyValuePair <string, object> > customData = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("Reason", reason) }; AssistantsLog.InternalLogRow(activityId, assistantName, assistant, AssistantsEventType.FilterMailbox, customData, mailboxGuid); AssistantsLog.LogMailboxSlaEvent(assistant, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, null, MailboxSlaEventType.FilterMailbox, filterReason, null); }
internal static void LogBeginJob(string assistantName, string databaseName, int startingPendingQueueCount) { List <KeyValuePair <string, object> > customData = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("DatabaseName", databaseName), new KeyValuePair <string, object>("PendingQueueCount", startingPendingQueueCount) }; AssistantsLog.InternalLogRow(Guid.Empty, assistantName, null, AssistantsEventType.BeginJob, customData, Guid.Empty); }
protected override void InternalLogActivityEvent(IActivityScope activityScope, ActivityEventType eventType) { object userState = activityScope.UserState; AssistantBase assistantBase = null; string assistantShortName; if (activityScope.ActivityType == ActivityType.Global) { assistantShortName = "GlobalActivity"; } else { SystemTaskBase systemTaskBase = userState as SystemTaskBase; if (systemTaskBase != null) { assistantShortName = systemTaskBase.Workload.Id; } else { AssistantBase assistantBase2 = userState as AssistantBase; if (assistantBase2 == null) { return; } assistantBase = assistantBase2; assistantShortName = assistantBase.NonLocalizedName; } } AssistantsEventType eventType2; switch (eventType) { case ActivityEventType.SuspendActivity: eventType2 = AssistantsEventType.SuspendActivity; goto IL_92; case ActivityEventType.EndActivity: eventType2 = AssistantsEventType.EndActivity; goto IL_92; } base.SafeTraceDebug(0L, "Skip logging ActivityEvent '{0}'.", new object[] { eventType }); return; IL_92: List <KeyValuePair <string, object> > customData = WorkloadManagementLogger.FormatWlmActivity(activityScope, true); AssistantsLog.InternalLogRow(activityScope.ActivityId, assistantShortName, assistantBase, eventType2, customData, Guid.Empty); }
internal static void LogErrorEnumeratingMailboxes(ITimeBasedAssistant assistant, Guid mailboxGuid, Exception exception, bool isExceptionHandled) { string value = (exception.InnerException != null) ? exception.InnerException.GetType().ToString() : string.Empty; List <KeyValuePair <string, object> > customData = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("MailboxGuid", mailboxGuid.ToString()), new KeyValuePair <string, object>("ExceptionType", exception.GetType().ToString()), new KeyValuePair <string, object>("InnerExceptionType", value), new KeyValuePair <string, object>("IsExceptionHandled", isExceptionHandled.ToString()), new KeyValuePair <string, object>("ExceptionDetail", exception.ToString()) }; AssistantsLog.InternalLogRow(Guid.Empty, (assistant != null) ? assistant.NonLocalizedName : string.Empty, null, AssistantsEventType.ErrorEnumeratingMailbox, customData, Guid.Empty); AssistantsLog.LogDatabaseSlaEvent(assistant as AssistantBase, DatabaseSlaEventType.ErrorMailboxTableQuery, exception); }
internal static void LogMailboxFailedToOpenStoreSessionEvent(Guid activityId, string assistantName, AssistantBase assistant, Exception storeSessionException, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage, TimeBasedDatabaseJob job) { List <KeyValuePair <string, object> > list = new List <KeyValuePair <string, object> >(); if (storeSessionException != null) { list.Add(new KeyValuePair <string, object>("ExceptionType", storeSessionException.GetType().ToString())); list.Add(new KeyValuePair <string, object>("ExceptionMessage", storeSessionException.Message)); if (storeSessionException.InnerException != null) { list.Add(new KeyValuePair <string, object>("InnerExceptionType", storeSessionException.InnerException.GetType().ToString())); list.Add(new KeyValuePair <string, object>("InnerExceptionMessage", storeSessionException.InnerException.Message)); } } AssistantsLog.InternalLogRow(activityId, assistantName, assistant, AssistantsEventType.FailedOpenMailboxStoreSession, list, mailboxGuid); AssistantsLog.LogMailboxSlaEvent(assistant, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, job, MailboxSlaEventType.FailedOpenMailboxStoreSession, MailboxSlaFilterReasonType.None, storeSessionException); }
internal static void LogFolderSyncExceptionEvent(Guid activityId, string assistantName, List <KeyValuePair <string, object> > customData) { AssistantsLog.InternalLogRow(activityId, assistantName, null, AssistantsEventType.FolderSyncException, customData, Guid.Empty); }
internal static void LogNoMailboxesPendingEvent(string assistantName) { AssistantsLog.InternalLogRow(Guid.Empty, assistantName, null, AssistantsEventType.NoMailboxes, null, Guid.Empty); }
internal static void LogJobAlreadyRunningEvent(string assistantName) { AssistantsLog.InternalLogRow(Guid.Empty, assistantName, null, AssistantsEventType.JobAlreadyRunning, null, Guid.Empty); }
internal static void LogDriverNotStartedEvent(string assistantName, AssistantBase assistant) { AssistantsLog.InternalLogRow(Guid.Empty, assistantName, null, AssistantsEventType.DriverNotStarted, null, Guid.Empty); AssistantsLog.LogDatabaseSlaEvent(assistant, DatabaseSlaEventType.DatabaseIsStopped, null); }
internal static void LogMailboxSucceedToOpenStoreSessionEvent(Guid activityId, string assistantName, AssistantBase assistant, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage, TimeBasedDatabaseJob job) { AssistantsLog.InternalLogRow(activityId, assistantName, assistant, AssistantsEventType.SucceedOpenMailboxStoreSession, null, mailboxGuid); AssistantsLog.LogMailboxSlaEvent(assistant, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, job, MailboxSlaEventType.SucceedOpenMailboxStoreSession, MailboxSlaFilterReasonType.None, null); }
internal static void LogMailboxNotInterestingEvent(Guid activityId, string assistantName, AssistantBase assistant, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage) { AssistantsLog.InternalLogRow(activityId, assistantName, assistant, AssistantsEventType.MailboxNotInteresting, null, mailboxGuid); AssistantsLog.LogMailboxSlaEvent(assistant, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, null, MailboxSlaEventType.MailboxNotInteresting, MailboxSlaFilterReasonType.None, null); }
internal static void LogMailboxInterestingEvent(Guid activityId, string assistantName, List <KeyValuePair <string, object> > customData, Guid mailboxGuid) { AssistantsLog.InternalLogRow(activityId, assistantName, null, AssistantsEventType.MailboxInteresting, customData, mailboxGuid); }
internal static void LogMailboxInterestingEvent(Guid activityId, string assistantName, AssistantBase assistant, List <KeyValuePair <string, object> > customData, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage) { AssistantsLog.InternalLogRow(activityId, assistantName, assistant, AssistantsEventType.MailboxInteresting, customData, mailboxGuid); AssistantsLog.LogMailboxSlaEvent(assistant, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, null, MailboxSlaEventType.MailboxInteresting, MailboxSlaFilterReasonType.None, null); }
internal static void LogEndJobEvent(string assistantName, List <KeyValuePair <string, object> > customData) { AssistantsLog.InternalLogRow(Guid.Empty, assistantName, null, AssistantsEventType.EndJob, customData, Guid.Empty); }
private static void InternalLogAssistantEvent(Guid activityId, AssistantBase assistant, AssistantsEventType eventType, List <KeyValuePair <string, object> > customData, Guid mailboxGuid) { string assistantShortName = (assistant == null) ? "Unknown" : assistant.NonLocalizedName; AssistantsLog.InternalLogRow(activityId, assistantShortName, assistant, eventType, customData, mailboxGuid); }
internal static void LogServiceStopEvent(Guid activityId) { AssistantsLog.InternalLogRow(activityId, "AssistantsService", null, AssistantsEventType.ServiceStopped, null, Guid.Empty); }