public static void Start()
 {
     logDirectoryPath = System.IO.Path.GetTempPath();
     logFileName = System.IO.Path.Combine(logDirectoryPath, "collector " + DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss") + ".log");
     try
     {
         using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(
             new System.IO.FileStream(logFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite)
             ))
         {
             streamWriter.WriteLine("Collector Started");
         }
     }
     catch (System.IO.IOException ioexception)
     {
         Console.WriteLine("Error creating log file " + ioexception);
     }
     myEvents = new MonitoredEventCollection();
     myEvents.RegisterEventInventoryForEventMonitoring();
 }
예제 #2
0
 public static void Start()
 {
     logDirectoryPath = System.IO.Path.GetTempPath();
     logFileName      = System.IO.Path.Combine(logDirectoryPath, "collector " + DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss") + ".log");
     try
     {
         using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(
                    new System.IO.FileStream(logFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite)
                    ))
         {
             streamWriter.WriteLine("Collector Started");
         }
     }
     catch (System.IO.IOException ioexception)
     {
         Console.WriteLine("Error creating log file " + ioexception);
     }
     myEvents = new MonitoredEventCollection();
     myEvents.RegisterEventInventoryForEventMonitoring();
 }