private void LogStoreDriverMailboxFilterEvent(TimeSpan filterLogInterval, Guid activityId, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage, string message, MailboxSlaFilterReasonType filterReason, params object[] args)
        {
            DateTime utcNow = DateTime.UtcNow;
            Tuple <string, MailboxSlaFilterReasonType> key = Tuple.Create <string, MailboxSlaFilterReasonType>(base.Assistant.NonLocalizedName, filterReason);

            if (this.filterEventsLastLogDateTimes.ContainsKey(key) && utcNow - this.filterEventsLastLogDateTimes[key] < filterLogInterval)
            {
                return;
            }
            string arg = string.Format("{0}: ", this);
            string text;

            if (!string.IsNullOrEmpty(message))
            {
                if (args != null)
                {
                    text = string.Format("{0}{1}", arg, string.Format(message, args));
                }
                else
                {
                    text = string.Format("{0}{1}", arg, message);
                }
            }
            else
            {
                text = string.Empty;
            }
            ExTraceGlobals.TimeBasedDatabaseDriverTracer.TraceDebug((long)this.GetHashCode(), text);
            AssistantsLog.LogMailboxFilteredEvent(activityId, base.Assistant.NonLocalizedName, base.Assistant as AssistantBase, text, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, filterReason);
            this.filterEventsLastLogDateTimes[key] = utcNow;
        }
        private static void LogMailboxSlaEvent(AssistantBase assistant, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage, TimeBasedDatabaseJob job, MailboxSlaEventType eventType, MailboxSlaFilterReasonType reason = MailboxSlaFilterReasonType.None, Exception exception = null)
        {
            string text         = "Unknown";
            string databaseName = "Unknown";
            string jobId        = string.Empty;
            MailboxSlaRequestType requestType = MailboxSlaRequestType.Unknown;

            if (assistant != null)
            {
                databaseName = ((assistant.DatabaseInfo == null) ? "Unknown" : assistant.DatabaseInfo.DatabaseName);
                text         = assistant.NonLocalizedName;
            }
            if (job != null)
            {
                jobId       = job.StartTime.ToString("O");
                requestType = ((job is TimeBasedDatabaseWindowJob) ? MailboxSlaRequestType.Scheduled : MailboxSlaRequestType.OnDemand);
            }
            MailboxAssistantsSlaReportLogFactory.MailboxAssistantsSlaReportLog logInstance = MailboxAssistantsSlaReportLogFactory.GetLogInstance(text, SlaLogType.MailboxSlaLog);
            if (logInstance != null)
            {
                logInstance.LogMailboxEvent(text, databaseName, jobId, requestType, mailboxGuid, mailboxDisplayNameTracingOnlyUsage, eventType, reason, exception);
            }
        }
Exemple #3
0
            // Token: 0x060005AD RID: 1453 RVA: 0x0001BB20 File Offset: 0x00019D20
            internal void LogMailboxEvent(string assistantName, string databaseName, string jobId, MailboxSlaRequestType requestType, Guid mailboxGuid, string mailboxDisplayNameTracingOnlyUsage, MailboxSlaEventType eventType, MailboxSlaFilterReasonType reason = MailboxSlaFilterReasonType.None, Exception exception = null)
            {
                if (!this.ShouldLog())
                {
                    return;
                }
                LogRowFormatter logRowFormatter = new LogRowFormatter(base.LogSchema);

                logRowFormatter[1]  = this.ServerName;
                logRowFormatter[2]  = (assistantName ?? string.Empty);
                logRowFormatter[3]  = (databaseName ?? string.Empty);
                logRowFormatter[4]  = (jobId ?? string.Empty);
                logRowFormatter[5]  = ((requestType == MailboxSlaRequestType.Unknown) ? string.Empty : requestType.ToString());
                logRowFormatter[6]  = ((mailboxGuid == Guid.Empty) ? string.Empty : mailboxGuid.ToString("D"));
                logRowFormatter[7]  = eventType.ToString();
                logRowFormatter[8]  = ((reason == MailboxSlaFilterReasonType.None) ? string.Empty : reason.ToString());
                logRowFormatter[9]  = ((exception != null) ? exception.GetType().ToString() : string.Empty);
                logRowFormatter[10] = ((exception != null && exception.InnerException != null) ? exception.InnerException.GetType().ToString() : string.Empty);
                base.AppendLog(logRowFormatter);
                if (base.IsDebugTraceEnabled)
                {
                    string message = string.Format("Assistant: {0}, Server: {1}, Database: {2}, WindowJob: {3}, Request: {4}, Mailbox: {5}, Event: {6}, Reason: {7}, Exception: {8}", new object[]
                    {
                        assistantName,
                        this.ServerName,
                        databaseName ?? string.Empty,
                        jobId ?? string.Empty,
                        requestType,
                        string.IsNullOrEmpty(mailboxDisplayNameTracingOnlyUsage) ? mailboxGuid.ToString("D") : mailboxDisplayNameTracingOnlyUsage,
                        eventType,
                        (reason == MailboxSlaFilterReasonType.None) ? string.Empty : reason.ToString(),
                        (exception != null) ? exception.Message : string.Empty
                    });
                    base.SafeTraceDebug((long)this.GetHashCode(), message, new object[0]);
                }
            }
        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);
        }