如何使用WriteEvent

问题描述:

我尝试使用下面的方法来设置事件级别为关键,以记录一个事件为严重:如何使用WriteEvent

WriteEvent(id, categoryName, EventSeverity.ErrorCritical, entry); 

但在事件日志中只显示事件级别为错误而不是批评。 是否有其他需要设置的配置和参数?

你的意思是Microsoft.SharePoint.Administration.EventSeverity?它被ShP使用并映射到它自己的事件日志中。

使用System.Diagnostics.EventLogEntryType映射到Windows事件日志的正确方法:

Error 
Warning 
Information 
SuccessAudit 
FailureAudit 
+0

谢谢您的回答。是的,我正在使用Microsoft.SharePoint.Administration.EventSeverity,因为它在SharePoint项目上。 – user1551413 2012-07-25 14:50:13

+0

@ user1551413:我认为ShP事件日志条目类型将间接地映射到Windows事件日志条目类型。 – abatishchev 2012-07-25 14:54:30

+0

我明白了。我在事件查看器中看到SharePoint默认事件设置为“关键”,但无法使用该方法。 – user1551413 2012-07-25 15:00:00