System.Diagnostics 提供 EventLog 與 EventLogEntry 兩大類別操作系統日誌。
| 屬性 | 說明 |
|---|---|
| Entries | 回傳 EventLogEntryCollection,日誌內容集合 |
| Log | 日誌名稱:"Application"、"System"、"Security",預設空字串 |
| LogDisplayName | 友好顯示名稱 |
| MachineName | 讀寫事件的電腦名稱 |
| Source | 寫入時註冊的來源名稱 |
| 屬性 | 說明 |
|---|---|
| Category / CategoryNumber | 類別文字 / 編號 |
| Data | 原始二進位資料 |
| EntryType | 事件類型枚舉: Error 嚴重錯誤、FailureAudit 失敗稽核、Information 資訊、SuccessAudit 成功稽核、Warning 警告 |
| EventID | 應用程式特定事件識別碼 |
| Index | 日誌中索引 |
| MachineName | 產生事件的電腦名稱 |
| Message | 本地化訊息文字 |
| ReplacementStrings | 替換字串陣列 |
| Source | 來源應用程式名稱 |
| TimeGenerated / TimeWritten | 產生時間 / 寫入時間 (本地時間) |
| UserName | 負責使用者名稱 |
定義 WMI 實例集合的大小與列舉器,無公開建構子。
下篇將提供完整讀取程式碼範例。