Esempio n. 1
0
 public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type, int eventID, short category)
 {
 }
Esempio n. 2
0
 public bool WriteLog(string _log, System.Diagnostics.EventLogEntryType _logType)
 {
     return(true);
 }
Esempio n. 3
0
 public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type)
 {
 }
Esempio n. 4
0
        /// <summary>
        /// Returns hierarchical representation of Events as far as text can go.
        /// </summary>
        /// <param name="entryType">Entry type filter for returned events</param>
        /// <param name="recursionDepth">How deep in the recurtion we are.</param>
        private string ToString(System.Diagnostics.EventLogEntryType?entryType, byte recursionDepth)
        {
            //Group the Events by their Type
            char chaTab = char.Parse("\t");

            System.Diagnostics.EventLogEntryType[] arrEntryTypes;
            if (entryType == null)
            {
                arrEntryTypes    = new System.Diagnostics.EventLogEntryType[3];
                arrEntryTypes[0] = System.Diagnostics.EventLogEntryType.Error;
                arrEntryTypes[1] = System.Diagnostics.EventLogEntryType.Warning;
                arrEntryTypes[2] = System.Diagnostics.EventLogEntryType.Information;
            }
            else
            {
                arrEntryTypes    = new System.Diagnostics.EventLogEntryType[1];
                arrEntryTypes[0] = (System.Diagnostics.EventLogEntryType)entryType;
            }
            System.Text.StringBuilder stbAll = new System.Text.StringBuilder();
            for (int intEntryType = 0; intEntryType < arrEntryTypes.Length; intEntryType++)
            {
                System.Text.StringBuilder stb = new System.Text.StringBuilder();
                #region Output local events
                for (int i = 0; i < _Events.Count; i++)           //We do not provide enumerator for this class. We want things to happen inside
                {
                    Event evt = _Events[i];
                    if (EventsMetadata.Event(evt.EventId).Type == arrEntryTypes[intEntryType])
                    {
                        stb.Append(Environment.NewLine);
//						stb.Append(Environment.NewLine);
                        stb.Append(chaTab, recursionDepth + 1);
                        stb.Append(evt.TimeStamp.ToString(TimeStampFormat)); stb.Append(chaTab);
//USE PADDING !!!!!!!!!!!!!!!!!
                        stb.Append(evt.Location.PadRight(25)); stb.Append(chaTab);
                        stb.Append(EventsMetadata.Event(evt.EventId).ToString(evt.EventParams).Replace(Environment.NewLine, Environment.NewLine + UTILS.Repeat("\t", recursionDepth + 9)));
                    }
                }
                #endregion
                #region Recursively add inner events
                if (_DownstreamEventsCollections.Count > 0)              //Otherwise don't even bother
                //You can still have all the elements of undesireable type, so first find if you have something to report
                {
                    System.Text.StringBuilder stbInner = new System.Text.StringBuilder();
                    for (int ii = 0; ii < _DownstreamEventsCollections.Count; ii++)
                    {
                        string strInnerEvents = _DownstreamEventsCollections[ii].ToString(arrEntryTypes[intEntryType], (byte)(recursionDepth + 1));
                        if (strInnerEvents != "")
                        {
                            stbInner.Append(Environment.NewLine);
                            stbInner.Append(Environment.NewLine);
                            stbInner.Append(chaTab, recursionDepth + 1);
                            stbInner.Append(_DownstreamEventsCollections[ii].OwnerObjectNameForReporting);                            //Type of the object
                            stbInner.Append(":");
                            stbInner.Append(chaTab);
                            stbInner.Append("[");
                            stbInner.Append(_DownstreamEventsCollections[ii].OwnerObjectId);                            //Name of the object
                            stbInner.Append("]");
                            stbInner.Append(strInnerEvents);
                        }
                    }
                    if (stbInner.Length > 0)                   //Then there are inner events to report in this type.
//						if(recursionDepth>0){//In current implementation, the topmost level rarely has own events, but that may change
                    {
                        stb.Append(Environment.NewLine);
                        stb.Append(Environment.NewLine);
                        stb.Append(chaTab, recursionDepth + 1);
                        stb.Append("INNER EVENTS:");
//						}
                        stb.Append(stbInner);
                    }
                }
                #endregion
                #region Append EventType if there is something to append, and we are at the top level of recursion
                if (stb.Length > 0 && recursionDepth == 0)           //Otherwise at the top of the entire thing the Type is already printed
                {
                    stbAll.Append(Environment.NewLine);
                    stbAll.Append(Environment.NewLine);
                    stbAll.Append(Environment.NewLine);
                    stbAll.Append(arrEntryTypes[intEntryType].ToString().ToUpper());
                    switch (arrEntryTypes[intEntryType])
                    {
                    case System.Diagnostics.EventLogEntryType.Error:
                    case System.Diagnostics.EventLogEntryType.Warning:
                        stbAll.Append("S");
                        break;
                    }
                    stbAll.Append(":");
                }
                #endregion

                stbAll.Append(stb);
            }            //for(int intEntryType=0;intEntryType<arrEntryTypes.Length;intEntryType++)
            return(stbAll.ToString());
        }
Esempio n. 5
0
        protected void Log(System.Diagnostics.EventLogEntryType type, string format, params object[] args)
        {
            string message = string.Format(format, args);

            Log(type, message);
        }
Esempio n. 6
0
 public EventInstance(long instanceId, int categoryId, System.Diagnostics.EventLogEntryType entryType)
 {
 }
Esempio n. 7
0
 private static void WriteLogEntry(string message, System.Diagnostics.EventLogEntryType entryType, string eventLogSource)
 {
     System.Diagnostics.EventLog.WriteEntry("WIKI-" + eventLogSource, message, entryType, 5099);
 }
Esempio n. 8
0
 public static void logEntry(System.Diagnostics.EventLogEntryType type, String message)
 {
     logger.WriteEntry(type, message, "DataClient");
 }
		/// <summary>
		/// Returns hierarchical representation of Events as far as text can go.
		/// </summary>
		/// <param name="entryType">Entry type filter for returned events</param>
		/// <param name="recursionDepth">How deep in the recurtion we are.</param>
		private string ToString(System.Diagnostics.EventLogEntryType? entryType,byte recursionDepth) {
			//Group the Events by their Type
			char chaTab=char.Parse("\t");
			System.Diagnostics.EventLogEntryType[] arrEntryTypes;
			if(entryType==null){
				arrEntryTypes=new System.Diagnostics.EventLogEntryType[3];
				arrEntryTypes[0]=System.Diagnostics.EventLogEntryType.Error;
				arrEntryTypes[1]=System.Diagnostics.EventLogEntryType.Warning;
				arrEntryTypes[2]=System.Diagnostics.EventLogEntryType.Information;
			}
			else{
				arrEntryTypes=new System.Diagnostics.EventLogEntryType[1];
				arrEntryTypes[0]=(System.Diagnostics.EventLogEntryType)entryType;
			}
			System.Text.StringBuilder stbAll=new System.Text.StringBuilder();
			for(int intEntryType=0;intEntryType<arrEntryTypes.Length;intEntryType++){
				System.Text.StringBuilder stb=new System.Text.StringBuilder();
				#region Output local events
				for(int i=0;i<_Events.Count;i++) {//We do not provide enumerator for this class. We want things to happen inside
					Event evt=_Events[i];
					if(EventsMetadata.Event(evt.EventId).Type==arrEntryTypes[intEntryType]){
						stb.Append(Environment.NewLine);
//						stb.Append(Environment.NewLine);
						stb.Append(chaTab,recursionDepth+1);
						stb.Append(evt.TimeStamp.ToString(TimeStampFormat)); stb.Append(chaTab);
//USE PADDING !!!!!!!!!!!!!!!!!
						stb.Append(evt.Location.PadRight(25)); stb.Append(chaTab);
						stb.Append(EventsMetadata.Event(evt.EventId).ToString(evt.EventParams).Replace(Environment.NewLine,Environment.NewLine+UTILS.Repeat("\t",recursionDepth+9)));
					}
				}
				#endregion
				#region Recursively add inner events
				if(_DownstreamEventsCollections.Count>0){//Otherwise don't even bother
					//You can still have all the elements of undesireable type, so first find if you have something to report
					System.Text.StringBuilder stbInner=new System.Text.StringBuilder();
					for(int ii=0;ii<_DownstreamEventsCollections.Count;ii++){
						string strInnerEvents=_DownstreamEventsCollections[ii].ToString(arrEntryTypes[intEntryType],(byte)(recursionDepth+1));
						if(strInnerEvents!=""){
							stbInner.Append(Environment.NewLine);
							stbInner.Append(Environment.NewLine);
							stbInner.Append(chaTab,recursionDepth+1);
							stbInner.Append(_DownstreamEventsCollections[ii].OwnerObjectNameForReporting);//Type of the object
							stbInner.Append(":");
							stbInner.Append(chaTab);
							stbInner.Append("[");
							stbInner.Append(_DownstreamEventsCollections[ii].OwnerObjectId);//Name of the object
							stbInner.Append("]");
							stbInner.Append(strInnerEvents);
						}
					}
					if(stbInner.Length>0) {//Then there are inner events to report in this type. 
//						if(recursionDepth>0){//In current implementation, the topmost level rarely has own events, but that may change
							stb.Append(Environment.NewLine);
							stb.Append(Environment.NewLine);
							stb.Append(chaTab,recursionDepth+1);
							stb.Append("INNER EVENTS:");
//						}
						stb.Append(stbInner);
					}
				}
				#endregion
				#region Append EventType if there is something to append, and we are at the top level of recursion
				if(stb.Length>0&&recursionDepth==0) {//Otherwise at the top of the entire thing the Type is already printed
					stbAll.Append(Environment.NewLine);
					stbAll.Append(Environment.NewLine);
					stbAll.Append(Environment.NewLine);
					stbAll.Append(arrEntryTypes[intEntryType].ToString().ToUpper());
					switch(arrEntryTypes[intEntryType]){
						case System.Diagnostics.EventLogEntryType.Error:
						case System.Diagnostics.EventLogEntryType.Warning:
							stbAll.Append("S");
						break;
					}
					stbAll.Append(":");
				}
				#endregion
				
				stbAll.Append(stb);
			}//for(int intEntryType=0;intEntryType<arrEntryTypes.Length;intEntryType++)
			return stbAll.ToString();
		}
Esempio n. 10
0
 public void WriteToLog(eBaySvc.ErrorType error, System.Diagnostics.EventLogEntryType errorType)
 {
     throw new NotImplementedException();
 }
Esempio n. 11
0
 static public void RegistrarSuceso(string istrTextoSuceso, System.Diagnostics.EventLogEntryType iobjTipoSuceso)
 {
     System.Diagnostics.EventLog objMiLog = new System.Diagnostics.EventLog();
     objMiLog.Source = ".NET Runtime"; //Por defecto grabará con este origen de suceso
     objMiLog.WriteEntry(istrTextoSuceso, iobjTipoSuceso);
 }
Esempio n. 12
0
 /// <summary>
 /// Initialize l'objet lorsqu'on veut écrire dans le journal d'événement de Windows, dans un fichier et/ou dans la Console.
 /// </summary>
 /// <param name="evenLogType">Type d'événement.</param>
 /// <param name="path">Chemin où se trouve/créer le fichier journal. (Par ex. C:\journaux\)</param>
 /// <param name="filename">Nom du fichier journal. (Par ex. log.txt)</param>
 /// <param name="destination">Destination du texte à logger.</param>
 public static void Initialize(System.Diagnostics.EventLogEntryType evenLogType, string path, string filename, Destination destination)
 {
     Initialize(path, filename, evenLogType, destination);
 }
Esempio n. 13
0
 private static void WriteToWindowsEventLog(string appName, string text, System.Diagnostics.EventLogEntryType type)
 {
     System.Diagnostics.EventLog.WriteEntry(appName, text, type);
 }
 /// <summary>
 /// 记录系统日志 写数据库
 /// </summary>
 /// <param name="logName">日志名称</param>
 /// <param name="logMessage">日志信息</param>
 /// <param name="eventType">日志类型</param>
 public static void LogWindowsLog(string logName, string logMessage, System.Diagnostics.EventLogEntryType eventType)
 {
     Log4NetHelper.Instance.WriteWindowsLog(logName, logMessage, eventType);
 }
Esempio n. 15
0
 public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID)
 {
 }
Esempio n. 16
0
 /// <summary>
 /// Add a window event
 /// </summary>
 /// <param name="source">Application eg AusFarm</param>
 /// <param name="msg">Event Msg</param>
 /// <param name="eventLogType">Event Log Type, eg Success, Fail, Warning</param>
 /// <param name="eventID"></param>
 public static void addWinEvent(string source, string msg, System.Diagnostics.EventLogEntryType eventLogType, int eventID)
 {
     System.Diagnostics.EventLog.WriteEntry(source, msg, eventLogType, eventID);
 }
Esempio n. 17
0
 public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID, short category, byte[] rawData)
 {
 }
        private static bool LogEvent(string message, System.Diagnostics.EventLogEntryType type)
        {
            bool loggingType = false;

            try
            {
                bool logExists = System.Diagnostics.EventLog.Exists(EventLogName);
                if (!logExists)
                {
                    // log doesn't exist
                    System.Diagnostics.EventLog.CreateEventSource(EventLogSourceName, EventLogName);
                }
                System.Diagnostics.EventLog myEventLog = new System.Diagnostics.EventLog(EventLogName);
                myEventLog.Source = EventLogSourceName;
                if (isLoggingEnabled)
                {
                    switch (type)
                    {
                    case System.Diagnostics.EventLogEntryType.Error:
                        loggingType = LoggingErrorEvents;
                        break;

                    case System.Diagnostics.EventLogEntryType.Warning:
                        loggingType = LoggingWarnEvents;
                        break;

                    case System.Diagnostics.EventLogEntryType.Information:
                        loggingType = LoggingInfoEvents;
                        break;

                    case System.Diagnostics.EventLogEntryType.SuccessAudit:
                        loggingType = LoggingAuditSuccessEvents;
                        break;

                    case System.Diagnostics.EventLogEntryType.FailureAudit:
                        loggingType = LoggingAuditFailureEvents;
                        break;

                    default:
                        loggingType = false;
                        break;
                    }

                    if (loggingType)
                    {
                        if (type == System.Diagnostics.EventLogEntryType.Error)
                        {
                            try
                            {
                                dict = null;
                                dict = new Dictionary <string, object>();
                                dict.Add("Date & Time   :", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                                dict.Add("Message       :", message);
                                logEntry         = new LogEntry();
                                logEntry.Message = "MSIG Data Service Process - # : " + message;
                                logEntry.Categories.Add("General");
                                if (dict != null)
                                {
                                    logEntry.ExtendedProperties = dict;
                                }
                                Logger.Write(logEntry);
                            }
                            catch
                            {
                            }
                        }
                        // max length for an event log message is 32k
                        myEventLog.WriteEntry((message.Length > 31500 ? message.Substring(0, 31500) + "...Message Truncated" : message), type);
                    }
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        } // end log event
        public static void LogError(string categoryName, string source, string message, System.Diagnostics.EventLogEntryType type)
        {
            SPDiagnosticsCategory category = LoggingService.Current.Areas[AREA_NAME].Categories[categoryName];
            string        format           = "Source: {0} - Type: {2} - Message: {1}";
            TraceSeverity severity         = TraceSeverity.Verbose;

            switch (type)
            {
            case System.Diagnostics.EventLogEntryType.Error:
                severity = TraceSeverity.Unexpected;
                break;

            case System.Diagnostics.EventLogEntryType.FailureAudit:
                severity = TraceSeverity.Unexpected;
                break;

            case System.Diagnostics.EventLogEntryType.Information:
                break;

            case System.Diagnostics.EventLogEntryType.SuccessAudit:
                severity = TraceSeverity.Verbose;
                break;

            case System.Diagnostics.EventLogEntryType.Warning:
                severity = TraceSeverity.Medium;
                break;

            default:
                break;
            }
            LoggingService.Current.WriteTrace(0, category, severity, format, source, message, type.ToString());
        }
Esempio n. 20
0
 //---------------------------------------------
 static protected void SendLogMessage(string _Message, System.Diagnostics.EventLogEntryType _Type, Exception _Exception = null)
 {
     Logger.AddMessageToLog(new LogMessage(_Message, "Database", _Type, _Exception));
 }
Esempio n. 21
0
 /// <summary>
 /// Writes the log entry.
 /// </summary>
 /// <param name="source">The event source.</param>
 /// <param name="logName">The log name.</param>
 /// <param name="message">The message.</param>
 /// <param name="type">The type.</param>
 public static void WriteEntry(string source, string logName, string message, System.Diagnostics.EventLogEntryType type)
 {
     CheckEventSource(source, logName);
     System.Diagnostics.EventLog.WriteEntry(source, message, type);
 }
Esempio n. 22
0
 protected override void DoWrite(string content, System.Diagnostics.EventLogEntryType type)
 {
 }