I am trying to write a Node app that, once deployed, will log to Windows Event Log.
I looked through available packages and was able to successfully use node-windows to write logs to the Windows Event Viewer when I ran the app using the command line. However, when I used pkg to turn the app into an .exe file and tried to run the .exe file, it was no longer logging to Windows Event Log.
As an example, I tried writing a basic app as follows:
const EventLogger = require('node-windows').EventLogger;
const log = new EventLogger('TestApp');
log.info('Test test test!', 1000)
If I run this app using the command line (e.g. node index.js), it logs to Windows Event Viewer. However, when I run pkg to convert the project into an executable file and try to run the executable file (both as an instance and using Windows Task Scheduler), it no longer logs out.
I have already checked to ensure that the .exe is running as administrator, so I don't think it is an issue with permissions. Anyone have any thoughts on why the .exe may not be logging out? Are there any other NPM packages/libraries that provide the ability to log to Windows Event Log?
Thank you in advance!