public static void Write(EventLogEntry entry) { try { if (entry.ApplicationType != ApplicationType.NoSet && (entry.EventType == EventType.Information || entry.EventType == EventType.Debug)) { entry.Uniquekey = ""; CommConfig config = CommConfig.GetConfig(); CommonDataProvider.Instance().WriteEventLogEntry(entry); return; } string key = string.Empty; if (entry.EventType == EventType.Warning) { key = GlobalKey.EVENTLOG_KEY + "_" + string.Format("{0}-{1}-{2}-{3}-{4}", entry.ApplicationID, entry.EntryID, entry.EventID, (int)entry.EventType, entry.Message.GetHashCode()); } else if (entry.EventType == EventType.Error && entry.Ex != null) { key = GlobalKey.EVENTLOG_KEY + "_" + string.Format("{0}-{1}-{2}-{3}-{4}-{5}", entry.ApplicationID, entry.EntryID, entry.EventID, (int)entry.EventType, entry.Ex.StackTrace.GetHashCode(), entry.Ex.Message.GetHashCode()); entry.Message = entry.Ex.Message + "-" + entry.Ex.StackTrace + "\r\n" + entry.Message; } else { key = GlobalKey.EVENTLOG_KEY + "_" + string.Format("{0}-{1}", (int)entry.EventType, entry.Message.GetHashCode()); } EventLogEntry oldentry = MangaCache.Get(key) as EventLogEntry; if (oldentry != null) { oldentry.PCount++; oldentry.LastUpdateTime = DateTime.Now; } else { DateTime time = DateTime.Now; entry.PCount = 1; entry.Uniquekey = key; entry.AddTime = time; entry.LastUpdateTime = time; CommConfig config = CommConfig.GetConfig(); CommonDataProvider.Instance().WriteEventLogEntry(entry); entry.PCount = 0; MangaCache.Add(key, entry, 30, TimeSpan.Zero, System.Web.Caching.CacheItemPriority.AboveNormal, new CacheItemRemovedCallback(RemovedCallback)); } } catch { } }