windows自定义日志任务类型
自定义windows日志中的任务类型// Create an instance of an EventLogInstaller.
myEventLogInstaller = new EventLogInstaller();
// Set the source name of the event log.
myEventLogInstaller.Source = "ApplicationEventSource";
// Set the event log into which the source writes entries.
//myEventLogInstaller.Log = "MyCustomLog";
myEventLogInstaller.Log = "myNewLog";
// Set the resource file for the event log.
// The message strings are defined in EventLogMsgs.mc; the message
// identifiers used in the application must match those defined in the
// corresponding message resource file. The messages must be built
// into a Win32 resource library and copied to the target path on the
// system.
myEventLogInstaller.CategoryResourceFile =
Environment.SystemDirectory + "\\eventlogmsgs.dll";
myEventLogInstaller.CategoryCount = 3;
myEventLogInstaller.MessageResourceFile =
Environment.SystemDirectory + "\\eventlogmsgs.dll";
myEventLogInstaller.ParameterResourceFile =
Environment.SystemDirectory + "\\eventlogmsgs.dll";
// Add myEventLogInstaller to the installer collection.
Installers.Add(myEventLogInstaller);
但是myEventLogInstaller.CategoryResourceFile 这个怎么样自定义啊
不知道怎么弄
有知道的大神帮帮忙 谢谢啦! --------------------编程问答-------------------- 哪有这么复制,很简单啊
System.Diagnostics--------------------编程问答-------------------- 我的意思是 我写入事件
代码一、最简单的代码
EventLog.WriteEntry("来源", "消息内容", EventLogEntryType.Information);
来源可以为任何随机字符串,但其名称必须不同于计算机上的其他来源名称。
代码二、或者也可以实例化类来实现,功能要强大些
EventLog eventLog = new EventLog();
eventLog.Log = "Windows PowerShell";
eventLog.Source = "来源";
eventLog.WriteEntry("消息内容", EventLogEntryType.Information);
事件任务类型EventLogEntryType是我自定义的
比如我传2进去 在
中显示出"地址状态配置事件"
这个意思 你说的那个我知道
谢谢啦! --------------------编程问答-------------------- 有谁知道的?求指教!!!! --------------------编程问答-------------------- 还是没人知道啊。。。
补充:.NET技术 , C#