【问题标题】:How to log an event as Critical using WriteEvent如何使用 WriteEvent 将事件记录为关键事件
【发布时间】:2012-07-25 11:27:46
【问题描述】:

我正在尝试使用以下方法将事件级别设置为关键:

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

但在事件日志中,它仅将事件级别显示为错误而不是严重。 还有其他需要设置的配置和参数吗?

【问题讨论】:

    标签: c# .net windows event-log event-viewer


    【解决方案1】:

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

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

    Error
    Warning
    Information
    SuccessAudit
    FailureAudit
    

    【讨论】:

    • 感谢您的回答。是的,我正在使用 Microsoft.SharePoint.Administration.EventSeverity,因为这是在 SharePoint 项目中。
    • @user1551413:我认为 ShP 事件日志条目类型间接映射到您所观察到的 Windows 事件日志条目类型。
    • 我明白了。我在事件查看器中看到 SharePoint 默认事件设置为关键事件,但无法使用该方法。
    • 我尝试使用 System.Diagnostics.EventLogEntryType 但仍然无法设置事件级别。你能给我一些指导吗?
    • @user1551413:我认为 Windows 事件日志支持最大严重性为错误,而不是严重。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-31
    • 1970-01-01
    • 1970-01-01
    • 2021-11-28
    • 1970-01-01
    相关资源
    最近更新 更多