c# - 如何使用 WriteEvent 将事件记录为 Critical

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

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

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

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

最佳答案

您是说 Microsoft.SharePoint.Administration.EventSeverity 吗?它由 ShP 使用并映射到它自己的事件日志。

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

Error
Warning
Information
SuccessAudit
FailureAudit

关于c# - 如何使用 WriteEvent 将事件记录为 Critical,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11648682/

相关文章:

c# - 为什么应用程序会抛出多个 "Operation is not valid due to the current state of the object"错误?

c# - 以编程方式选择 DataGridView 中的一行

windows - 如何以非管理员身份在 Windows 7 上安装 yarn?

c# - 对内存位置的无效访问 - 管理到非托管代码

c# - 将 float 转换为整数

c# - 如何将依赖项传递给自定义 .NET Core ILoggerProvider

java - Linksys 路由器 Web 管理 - 在 .NET 中自动登录

java - JNI4Net C# 到 Java

java - 如何获取系统信息语言环境 - Locale.getDefault()

c# - Windows 10 崩溃侦探