using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApplication22
{
class Program
{
static void Main(string[] args)
{
string sSource; //事件源
string sLog; //事件日志(名),又称为日志名。一个日志名可以对应多个事件源。
string sEvent; //消息
sSource = "litao application";
sLog = "李涛";
sEvent = "hello, word!";
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);
EventLog.WriteEntry(sSource, sEvent);
EventLog.WriteEntry(sSource, sEvent,
EventLogEntryType.Warning, 234);
}
}
}
事件查看器
最新推荐文章于 2023-01-06 08:00:00 发布