node-windows
node-windows copied to clipboard
Can't log into EventLog message with custom event id
hey- I am trying to store in EventViewer a log message with custom event id (different from 1000). i don't see my log get updated with this message.
Anyone has any clue why?
Is your process running with elevated administrative privileges? This is a requirement on Windows.
Yes. i opened power-shell as an administrator and ran the script.
tried to do: log.info("hello world!", 1005);
but the message is not there in the Event viewer
Sorry to drag up an old issue but i am having the same issues with this. It will not log with a custom event id number but will if its left at its default.
I've found this to be different across different versions of Windows. Which version are you running, @jdor12321?
Hi @coreybutler. I'm running this on Windows 7 Enterprise with the hope of running it on Windows Server 2003 R2 or the next version up ( I can't recall the version of the server). I haven't tested this on the server yet as was hoping go get it on PC first before deploying.
Hi, I have the same problem. 1000 logs fine but any other ID does not. Yes I'm elevated. Windows 10.
Correction: After some more investigation, it appears that 1000 is the maximum ID that can be handled. Specifying any event ID number up to 1000 will work. 1001 onwards does not.
Not sure how valid this source is but It would appear that the issue is using EventCreate which only lets you generate event ids between the range of 0 - 1000. A proposed solution would be to use LogEvent which allows integers from 0 - 65535. But note: EventCreate.exe lets you create events in either System or Application logs while LogEvent events are registered only in the Application log.
https://technet.microsoft.com/en-us/library/cc755240.aspx