class Program
static string logName = "WriteToHydeeExceptinLog";
static void Main(string[] args)
{
if (!EventLog.SourceExists(EventSource))
{
var eventSource = new EventSourceCreationData(EventSource, logName);
EventLog.CreateEventSource(eventSource);
}
EventLog log = new EventLog(logName,".",EventSource);
log.WriteEntry("服务启动",EventLogEntryType.Information);
log.Close();
//Method.SynchIndent();
}
{
static string EventSource = "WriteToHydee";static string logName = "WriteToHydeeExceptinLog";
static void Main(string[] args)
{
if (!EventLog.SourceExists(EventSource))
{
var eventSource = new EventSourceCreationData(EventSource, logName);
EventLog.CreateEventSource(eventSource);
}
EventLog log = new EventLog(logName,".",EventSource);
log.WriteEntry("服务启动",EventLogEntryType.Information);
log.Close();
//Method.SynchIndent();
}
}
运行程序是以 管理员身份安装和运行。