I have this OSX/Win console application that I am gradually turning into a service for windows and a LaunchDaemon for OSX.
Yesterday, I changed my AppLog subroutine to use System.Log instead of Print, and this works nicely for the OSX side, which after launch with launchctl logged correctly to the system log. If I launch it from the console, it redirects output to my terminal window instead of logging to the system.log, which is a bit strange, but it works for me. Already this tells me though something is not entirely OK.
Running it on windows server though ( 2012R2 ) I find nothing in the event log. It is not clear to me if I should find entries in the system or the applications log, both are displaying absolutly nothing. I’m launching from a terminal window, and output isn’t even redirected to the window.
I’m confused by this behaviour difference, and would really like to log to the Events log on Windows.
Because I do to keep the same code base for both WIndows and OSX, I have not turned the apps into a ServiceApplication and I am not daemonizing the app on OSX. I just have it as a console application, which is the best choice for me as I can easily test it. I use NSSM on Windows to turn it into a service, and it works fine on the logging if I “print” in my code instead of “system.log”, I redirect i/o to a file, presto. But I don’t want to do that. I want it to log to the Events log.
So in short, my question is: can I use System.Log() in a console application an make it log to the Windows Event log? And actually find entries back with the Event Viewer? Please help.