public static void Log(LogCategories category, LogEventID id, TraceEventType type, string message) { LogEntry entry = new LogEntry(); entry.EventId = (int)id; entry.Categories.Add(category.ToString()); entry.Message = message; entry.Severity = type; Logger.Write(entry); }
public void WriteXml(XmlWriter writer) { writer.WriteStartElement("log"); writer.WriteAttributeString("LogGUID", LogGUID); writer.WriteAttributeString("LogFileID", LogFileID); writer.WriteAttributeString("LogTypeKey", LogTypeKey); writer.WriteAttributeString("LogUserID", LogUserID.ToString()); writer.WriteAttributeString("LogEventID", LogEventID.ToString()); writer.WriteAttributeString("LogUserName", LogUserName); writer.WriteAttributeString("LogPortalID", LogPortalID.ToString()); writer.WriteAttributeString("LogPortalName", LogPortalName); writer.WriteAttributeString("LogCreateDate", LogCreateDate.ToString()); writer.WriteAttributeString("LogCreateDateNum", LogCreateDateNum.ToString()); writer.WriteAttributeString("BypassBuffering", BypassBuffering.ToString()); writer.WriteAttributeString("LogServerName", LogServerName); writer.WriteAttributeString("LogConfigID", LogConfigID); LogProperties.WriteXml(writer); writer.WriteEndElement(); }
public static void Error(LogEventID eventId, Exception ex, string message) { string message2 = message + "\r\n" + ex.ToString(); WriteEventLog(EventLogEntryType.Error, message2, eventId); }
public static void Error(LogEventID eventId, string message) { WriteEventLog(EventLogEntryType.Error, message, eventId); }
private static void WriteEventLogInner(EventLogEntryType entryType, string message, LogEventID eventId, int repeat) { // NextVersion //if (repeat != 1) { // message = string.Format("!!!Repeat ({0}) times within last 5 second.\r\n", repeat, message); //} EventLog.WriteEntry(_eventSource, message, entryType, (int)eventId); SystemLogEvent evt = new SystemLogEvent(); evt.ComputerName = ServiceEnviornment.ComputerName; evt.ServiceName = ServiceEnviornment.ServiceName; evt.Time = DateTime.Now; evt.Message = message; evt.Level = GetTracingLevel(entryType); evt.EventId = eventId; evt.Repeat = repeat; TracingManager.Enqueue(evt); }
private static void WriteEventLog(EventLogEntryType entryType, string message, LogEventID eventId) { try { if (_eventSource == null) { lock (_syncRoot) { if (_eventSource == null) { try { _eventSource = ServiceEnviornment.ServiceName + "-Service"; } catch (Exception) { _eventSource = null; } if (string.IsNullOrEmpty(_eventSource)) _eventSource = Process.GetCurrentProcess().ProcessName; EnsureEventSource(_eventSource); } } } WriteEventLogInner(entryType, message, eventId, 1); // // NextVersion //int repeat; //if (TracingManager.AntiRepeat) { // if (!AntiRepeater.IsRepeated(out repeat)) // WriteEventLogInner(entryType, message, eventId, repeat); //} else { // WriteEventLogInner(entryType, message, eventId, 1); //} } catch (Exception ex) { Unexcepted(ex); } }
public static void Warn(LogEventID eventId, string message) { WriteEventLog(EventLogEntryType.Warning, message, eventId); }
public static void Info(LogEventID eventId, string format, params object[] args) { string message = TracingHelper.FormatMessage(format, args); WriteEventLog(EventLogEntryType.Information, message, eventId); }
public static void Error(LogEventID eventId, string format, params object[] args) { string message = TracingHelper.FormatMessage(format, args); WriteEventLog(EventLogEntryType.Error, message, eventId); }
public static void Error(LogEventID eventId, string message) { WriteEventLog(EventLogEntryType.Error, message, eventId); }
public static void Warn(LogEventID eventId, string message) { WriteEventLog(EventLogEntryType.Warning, message, eventId); }
public static void Info(LogEventID eventId, string message) { WriteEventLog(EventLogEntryType.Information, message, eventId); }
private static void WriteEventLogInner(EventLogEntryType entryType, string message, LogEventID eventId, int repeat) { // NextVersion //if (repeat != 1) { // message = string.Format("!!!Repeat ({0}) times within last 5 second.\r\n", repeat, message); //} EventLog.WriteEntry(_eventSource, message, entryType, (int)eventId); SystemLogEvent evt = new SystemLogEvent(); evt.ComputerName = ServiceEnvironment.ComputerName; evt.ServiceName = ServiceEnvironment.ServiceName; evt.Time = DateTime.Now; evt.Message = message; evt.Level = GetTracingLevel(entryType); evt.EventId = eventId; evt.Repeat = repeat; TracingManager.Enqueue(evt); }
private static void WriteEventLog(EventLogEntryType entryType, string message, LogEventID eventId) { try { if (_eventSource == null) { lock (_syncRoot) { if (_eventSource == null) { try { _eventSource = ServiceEnvironment.ServiceName + "-Service"; } catch (Exception) { _eventSource = null; } if (string.IsNullOrEmpty(_eventSource)) { _eventSource = Process.GetCurrentProcess().ProcessName; } EnsureEventSource(_eventSource); } } } WriteEventLogInner(entryType, message, eventId, 1); // // NextVersion //int repeat; //if (TracingManager.AntiRepeat) { // if (!AntiRepeater.IsRepeated(out repeat)) // WriteEventLogInner(entryType, message, eventId, repeat); //} else { // WriteEventLogInner(entryType, message, eventId, 1); //} } catch (Exception ex) { Unexcepted(ex); } }
public static void Error(LogEventID eventId, Exception ex, string format, params object[] args) { string message = TracingHelper.FormatMessage(format, args) + "\r\n" + ex.ToString(); WriteEventLog(EventLogEntryType.Error, message, eventId); }
public static void Info(LogEventID eventId, string message) { WriteEventLog(EventLogEntryType.Information, message, eventId); }
public static void Error(LogEventID eventId, Exception ex, string message) { string message2 = message + "\r\n" + ex.ToString(); WriteEventLog(EventLogEntryType.Error, message2, eventId); }
public static void Error(LogEventID eventId, Exception ex, string format, params object[] args) { string message = TracingHelper.FormatMessage(format, args) + "\r\n" + ex.ToString(); WriteEventLog(EventLogEntryType.Error, message, eventId); }
public static void Record(LogEventID id) { }