急^_____________C#的日志文件怎么写?
C#的日志文件怎么写?
------解决方案--------------------6.将错误记录保存到Windows系统日志中 
 public class LogError 
     { 
         private const string c_EventSource =  "love "; 
         private const string c_LogName =  "Application ";           
         public static void Write(string errorMessage) 
         { 
             try 
             { 
                 //判断名称为 "love " 的事件源是否存在 
                 if (!EventLog.SourceExists(c_EventSource)) 
                 { 
                     //如果不存在就试图创建 
                     EventLog.CreateEventSource(c_EventSource, c_LogName); 
                 } 
                 // 已存在,写错误消息到日志 
                 EventLog msg = new EventLog(c_LogName); 
                 msg.Source = c_EventSource; 
                 msg.WriteEntry(errorMessage, EventLogEntryType.Error); 
             } 
             catch 
             { } 
         } 
     }