Cannot write to custom event log

284 views Asked by At

I have created a simple Windows service.
The service registers a custom event source and log.
For testing purposes I have named the log "asd" and the source ".asd".
Both the log and source are correctly created, the service is correctly installed and it is running fine.
However the log cannot be written to. No error or exception is thrown, just nothing happens.
I use the eventLog.WriteEntry method, where eventLog is the name of the service System.Diagnostics.EventLog component.
However nothing is written to said event log, even though I know the method executes and, at least, no exception is thrown so I surmise it has finished successfully.
I have tried writing to the log by starting Powershell as Administrator and using the Write-EventLog cmdlet, which works just fine if writing to, say, the Application log (with an appropriate source) but nothing happens if I use it to write to the custom "asd" log - no entry appears in Windows' Event Viewer even after refresh or restart of the Event Viewer.
Tried restarting the Windows Event Logging service but it fails due to having to also restart the Task Scheduler service, which is not accessible by the built-in Administrator account, because I'm using Windows 7 and it is stupid.

I was able to write to the custom event log a few builds ago but reverting fixes nothing and I haven't made any changes related to that.

Any help or ideas why I can't write to that log would be appreciated!

0

There are 0 answers