1
EventLog
を使用してプリンタ関連のログを取得しようとしています。C#のネストされたイベントログにアクセス
foreach (var e in EventLogSession.GlobalSession.GetLogNames()) {
Console.WriteLine(e);
}
を私は必要なログの名前ログインしました - Microsoft-Windows-PrintService/Operational
を:
私はそのように、this questionからヒントを使用して、システム内のすべてのログを列挙しました。
しかし、コードのこの作品は、クラッシュさ:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.dll
Additional information: The event log 'Microsoft-Windows-PrintService/Operational' on computer '.' does not exist.
と
var evt = new EventLog("Microsoft-Windows-PrintService/Operational");
を私は管理者の下でMSVC 2015を実行しています。
new EventLog("Application");
は、魅力的な働きをしています。どのようにカスタムネストされたイベントログを作成できますか?