Extracting Specific Data From XmlLogEntry Object Problem
-
hello everybody , i really need ur help if you deal with a Enterprise Library Logging Application Block before im trying to extract specific data from the log entery i use XmlLogEntry class and the output into xml file i tried to read from the xml file and it raise error that this xml is being used by another application and i dont know how to extract specifi data from that object i tried to use XML property but it also gave error i need to put Node every time the log works in another xml file becuase you know the output xml form the logging application block is invalid xml formate public void LogFirstFOrmatter(Exception ex,int ex_priority,string title, TraceEventType type,string errormsg,int eventID) { XmlLogEntry myxmlLog = new XmlLogEntry(); myxmlLog.Severity = type; myxmlLog.AddErrorMessage(errormsg); myxmlLog.EventId = eventID; myxmlLog.Message = ex.ToString(); myxmlLog.Priority = ex_priority; myxmlLog.Title = title; Logger.Write(myxmlLog); LoadLogFile("MyLog"); } public XDocument LoadLogFile(string name) { XDocument doc = new XDocument(); var tmpLog = Path.Combine(ConfigurationManager.AppSettings.Get("Path"),name); tmpLog += ".xml"; var fileContent = string.Empty; using (StreamReader reader = new StreamReader(tmpLog)) { fileContent = reader.ReadToEnd(); } doc = XDocument.Parse(fileContent); return doc; }
-
hello everybody , i really need ur help if you deal with a Enterprise Library Logging Application Block before im trying to extract specific data from the log entery i use XmlLogEntry class and the output into xml file i tried to read from the xml file and it raise error that this xml is being used by another application and i dont know how to extract specifi data from that object i tried to use XML property but it also gave error i need to put Node every time the log works in another xml file becuase you know the output xml form the logging application block is invalid xml formate public void LogFirstFOrmatter(Exception ex,int ex_priority,string title, TraceEventType type,string errormsg,int eventID) { XmlLogEntry myxmlLog = new XmlLogEntry(); myxmlLog.Severity = type; myxmlLog.AddErrorMessage(errormsg); myxmlLog.EventId = eventID; myxmlLog.Message = ex.ToString(); myxmlLog.Priority = ex_priority; myxmlLog.Title = title; Logger.Write(myxmlLog); LoadLogFile("MyLog"); } public XDocument LoadLogFile(string name) { XDocument doc = new XDocument(); var tmpLog = Path.Combine(ConfigurationManager.AppSettings.Get("Path"),name); tmpLog += ".xml"; var fileContent = string.Empty; using (StreamReader reader = new StreamReader(tmpLog)) { fileContent = reader.ReadToEnd(); } doc = XDocument.Parse(fileContent); return doc; }
Did you read its documentation, this sort of usage information must be documented some where with application.
Share your experience with others Check my Blog...