I am trying to get printer-related logs using EventLog.
I've enumerated all logs in system, using hint from this question, like that:
foreach (var e in EventLogSession.GlobalSession.GetLogNames()) {
Console.WriteLine(e);
}
And I got log name of needed log - Microsoft-Windows-PrintService/Operational.
However, this piece of code is crashing:
var evt = new EventLog("Microsoft-Windows-PrintService/Operational");
with
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.
I am running MSVC 2015 under administrator.
new EventLog("Application");
is working like a charm, how I can create custom nested event log?