How do you log things with NSSM

  • Page Owner: Not Set
  • Last Reviewed: 2018-09-04

My nssm service is all messed up how do I enable logging?

Comments

  • What is NSSM? Can you add a tag or two for this? I'm assuming it's .net?

Answer

nssm set <servicename> AppStdout "C:\nssm.log"
nssm set <servicename> AppStderr "C:\nssm.log"

Comments

  • I did not know you could do this.
  • Where do these lines go?

Additional Posts

Your can set these up via the NSSM gui by using the install/edit commands.

nssm install <servicename>

or

nssm edit <servicename>

Then, navigate to the I/O tab and set the logs using the file explorer.

Set up log files


As an added bonus, since you're enabling logging for the service, you can set up log rotation as well:

Enable log rotation

As an alternative to NSSM, you could use WinSW. This is another Windows service wrapper (used by Jenkins when installed on Windows) that uses XML for configuration.

https://github.com/kohsuke/winsw

With WinSW, To change logging, you update the XML and restart your service: https://github.com/kohsuke/winsw/blob/master/doc/loggingAndErrorReporting.md