private ExExecutionLog(string path) { string[] array = new string[ExExecutionLog.CommonFields.Length + CustomDataLogger.CustomFields.Length]; Array.Copy(ExExecutionLog.CommonFields, array, ExExecutionLog.CommonFields.Length); Array.Copy(CustomDataLogger.CustomFields, 0, array, ExExecutionLog.CommonFields.Length, CustomDataLogger.CustomFields.Length); this.logSchema = new LogSchema("Microsoft Exchange Server", Assembly.GetExecutingAssembly().GetName().Version.ToString(), "Unified Policy Log", array); this.logInstance = new Log(ExExecutionLog.GetLogFileName(), new LogHeaderFormatter(this.logSchema), "UnifiedPolicyLog"); this.logInstance.Configure(Path.Combine(ExchangeSetupContext.InstallPath, path), ExExecutionLog.LogMaxAge, 262144000L, 10485760L); }
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) { } } }