• establish log file in system


     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 using System.Diagnostics;
     7 
     8 
     9 namespace ConsoleApplication1
    10 {
    11     class Program
    12     {
    13         static void Main(string[] args)
    14         {
    15             EventLog log = new EventLog();
    16             try
    17             {
    18                 log.Source = "系统2";
    19                 log.WriteEntry("deal with message of one", EventLogEntryType.Information);
    20                 log.WriteEntry("deal with message of two",EventLogEntryType.Information);
    21                 throw new System.IO.FileNotFoundException("readme.txt文件未找到");
    22             }
    23             catch(System.IO.FileNotFoundException exception)
    24             {
    25                 log.WriteEntry("deal with message two",EventLogEntryType.Error);  
    26             }
    27 
    28         }
    29     }
    30 }
  • 相关阅读:
    排球教练积分程序
    排球积分程序
    排球积分程序
    14周总结
    本周总结
    排球计分规则
    我与计算机
    排球计分程序
    《如何成为一个高手》观后感
    十八周总结
  • 原文地址:https://www.cnblogs.com/Blue-Moniter4/p/9684596.html
Copyright © 2020-2023  润新知