Пример #1
0
 protected void LogOneEntry(ExecutionLog.EventType eventType, Exception exception, string messageFormat, params object[] args)
 {
     if (this.logger != null)
     {
         string contextData = string.Format(messageFormat, args);
         this.logger.LogOneEntry(this.client.ToString(), this.tenantId, this.logCorrelationId, eventType, this.logTag, contextData, exception, null);
     }
 }
        internal static string NotifyChangesByWorkload(Task task, IConfigurationSession configurationSession, Workload workload, IEnumerable <SyncChangeInfo> syncChangeInfos, bool fullSync, bool syncNow, ExecutionLog logger, Type client, out string notificationIdentifier)
        {
            Exception exception = null;

            notificationIdentifier = string.Empty;
            string text = string.Empty;

            try
            {
                CompliancePolicySyncNotificationClient compliancePolicySyncNotificationClient = AggregatedNotificationClients.workloadToNotificationClientsGetter[workload](configurationSession, new WriteVerboseDelegate(task.WriteVerbose));
                if (compliancePolicySyncNotificationClient != null)
                {
                    task.WriteVerbose(Strings.VerboseNotifyWorkloadWithChanges(workload.ToString(), string.Concat(from syncChangeInfo in syncChangeInfos
                                                                                                                  select syncChangeInfo.ToString())));
                    notificationIdentifier = compliancePolicySyncNotificationClient.NotifyPolicyConfigChanges(syncChangeInfos, fullSync, syncNow);
                    task.WriteVerbose(Strings.VerboseNotifyWorkloadWithChangesSuccess(workload.ToString(), notificationIdentifier));
                }
                else
                {
                    text = Strings.WarningNotificationClientIsMissing(workload.ToString());
                }
            }
            catch (CompliancePolicySyncNotificationClientException ex)
            {
                text      = Strings.ErrorMessageForNotificationFailure(workload.ToString(), ex.Message);
                exception = ex;
            }
            if (!string.IsNullOrEmpty(text))
            {
                logger.LogOneEntry(client.Name, string.Empty, ExecutionLog.EventType.Warning, string.Format("We failed to notify workload '{0}' with error message '{1}'", workload, text), exception);
                MonitoringItemErrorPublisher.Instance.PublishEvent("UnifiedPolicySync.SendNotificationError", UnifiedPolicyConfiguration.GetInstance().GetOrganizationIdKey(configurationSession), string.Format("Workload={0};Timestamp={1}", workload, DateTime.UtcNow), exception);
            }
            else
            {
                ExecutionLog.EventType eventType = ExecutionLog.EventType.Verbose;
                string   name          = client.Name;
                string   correlationId = notificationIdentifier;
                string   format        = "Notification '{0}' was sent to workload '{1}' with sync change info: '{2}'";
                object[] array         = new object[3];
                array[0] = notificationIdentifier;
                array[1] = workload;
                array[2] = string.Join(",", from x in syncChangeInfos
                                       select x.ToString());
                logger.LogOneEntry(eventType, name, correlationId, format, array);
            }
            return(text);
        }
Пример #3
0
        public override void LogOneEntry(string client, string tenantId, string correlationId, ExecutionLog.EventType eventType, string tag, string contextData, Exception exception, params KeyValuePair <string, object>[] customData)
        {
            LogRowFormatter logRowFormatter = new LogRowFormatter(this.logSchema);
            Stream          stream          = null;

            logRowFormatter[1] = client;
            logRowFormatter[2] = tenantId;
            logRowFormatter[3] = correlationId;
            logRowFormatter[4] = eventType;
            logRowFormatter[5] = tag;
            logRowFormatter[6] = contextData;
            CustomDataLogger.Log(customData, logRowFormatter, out stream);
            if (exception != null)
            {
                List <string> list  = null;
                List <string> list2 = null;
                string        value = null;
                ExecutionLog.GetExceptionTypeAndDetails(exception, out list, out list2, out value, false);
                logRowFormatter[7] = list[0];
                logRowFormatter[8] = list2[0];
                if (list.Count > 1)
                {
                    logRowFormatter[9]  = list[list.Count - 1];
                    logRowFormatter[10] = list2[list2.Count - 1];
                }
                if (!ExExecutionLog.ShouldSkipExceptionChainLogging(list))
                {
                    logRowFormatter[11] = value;
                }
                logRowFormatter[12] = exception.GetHashCode().ToString();
            }
            this.logInstance.Append(logRowFormatter, 0);
            if (stream != null)
            {
                try
                {
                    logRowFormatter.Write(stream);
                }
                catch (StorageTransientException)
                {
                }
                catch (StoragePermanentException)
                {
                }
            }
        }
Пример #4
0
        // Token: 0x0600004A RID: 74 RVA: 0x000032D0 File Offset: 0x000014D0
        private static ULSTraceLevel ConvertEventTypeToULSLevel(ExecutionLog.EventType eventType)
        {
            switch (eventType)
            {
            case ExecutionLog.EventType.Verbose:
                return(100);

            case ExecutionLog.EventType.Information:
                return(50);

            case ExecutionLog.EventType.Warning:
                return(20);

            case ExecutionLog.EventType.Error:
            case ExecutionLog.EventType.CriticalError:
                return(10);

            default:
                return(50);
            }
        }
Пример #5
0
 protected void LogOneEntry(ExecutionLog.EventType eventType, string messageFormat, params object[] args)
 {
     this.LogOneEntry(eventType, null, messageFormat, args);
 }
Пример #6
0
 public override void LogOneEntry(string client, string correlationId, ExecutionLog.EventType eventType, string contextData, Exception exception)
 {
     this.LogOneEntry(client, null, correlationId, eventType, string.Empty, contextData, exception, new KeyValuePair <string, object> [0]);
 }
Пример #7
0
        // Token: 0x06000049 RID: 73 RVA: 0x0000325C File Offset: 0x0000145C
        public override void LogOneEntry(string client, string tenantId, string correlationId, ExecutionLog.EventType eventType, string tag, string contextData, Exception exception, params KeyValuePair <string, object>[] customData)
        {
            ULSTraceLevel ulstraceLevel = FASTExcecutionLog.ConvertEventTypeToULSLevel(eventType);

            if (exception == null)
            {
                ULS.SendTraceTag(4850017U, ULSCat.msoulscat_SEARCH_DataLossPrevention, ulstraceLevel, "Client : [{0}] ; CorrelationId : [{1}] ; ContextData : [{2}]", new object[]
                {
                    client,
                    correlationId,
                    contextData
                });
                return;
            }
            ULS.SendTraceTag(4850018U, ULSCat.msoulscat_SEARCH_DataLossPrevention, ulstraceLevel, "Client=[{0}]  CorrelationId=[{1}]  ContextData=[{2}]  Exception=[{3}]", new object[]
            {
                client,
                correlationId,
                contextData,
                exception
            });
        }
Пример #8
0
 // Token: 0x06000048 RID: 72 RVA: 0x0000323C File Offset: 0x0000143C
 public override void LogOneEntry(string client, string correlationId, ExecutionLog.EventType eventType, string contextData, Exception exception)
 {
     this.LogOneEntry(client, null, correlationId, eventType, null, contextData, exception, null);
 }