EventLog.CreateEventSource不是创建一个自定义日志 [英] EventLog.CreateEventSource is not creating a custom log

查看:98
本文介绍了EventLog.CreateEventSource不是创建一个自定义日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些code是这样的:

I have some code like this:

EventLog.CreateEventSource("myApp", "myAppLog");
EventLog.WriteEntry("myApp", "Test log message", EventLogEntryType.Error);

现在,除非我失去了一些东西看了MSDN,这应该引起新的日志myAppLog要在事件查看器中创建和条目应该被添加到新的日志与源名称对myApp。但是,我不能要创建新的日志。这始终只是写一个错误日志消息应用程序日志,与源对myApp' - 'myAppLog'是无处可见。我究竟做错了什么?我登录的管理员。

Now, unless I'm missing something having read MSDN, this should cause a new log 'myAppLog' to be created in the event viewer, and an entry should be added to that new log with the source name 'myApp'. But, I can't get the new log to be created. This always just writes an error log message to the Application log, with the source 'myApp' - 'myAppLog' is nowhere to be seen. What am I doing wrong? I am logged in as an Administrator.

推荐答案

有没有可能是你已经使用的源写入标准应用程序日志时,对myApp?如果是这样,根据MSDN:

Is it possible that you already used the source "myApp" when writing to the standard Application log? If so according to MSDN:

如果一个源已经被映射到   一个记录和你重新映射到一个新的日志,   您必须重新启动计算机使   更改生效。

If a source has already been mapped to a log and you remap it to a new log, you must restart the computer for the changes to take effect.

<一个href="http://msdn.microsoft.com/en-us/library/2awhba7a.aspx">http://msdn.microsoft.com/en-us/library/2awhba7a.aspx (大约一半在页面)

http://msdn.microsoft.com/en-us/library/2awhba7a.aspx (about half way down the page)

这篇关于EventLog.CreateEventSource不是创建一个自定义日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆