zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    day06
    样式表
    框架&样式表
    表单
    用表格制作百度首页
    汉企教育实训第第二天
    汉企教育实训第一天感想
    BootStrap前端框架
    MySQL存储过程、存储函数介绍
    日常记录
  • 原文地址:https://www.cnblogs.com/Blue-Moniter4/p/9684596.html
Copyright © 2011-2022 走看看