coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.78k stars 357 forks source link

[question] err.log and out.log has size limited? #322

Closed radiorz closed 1 year ago

radiorz commented 1 year ago

Issue:

How To Reproduce:

start node-windows server in daemon the err.log and out.log will save the logs of service. but it seems that it could not contain too much logs.

Expected Behavior:

I can choose the size of logs

Desktop:

coreybutler commented 1 year ago

node-windows has no constraints on the log size, but winsw does. This can be overridden using the logging configiuration attribute in the server.

For example:

var svc = new Service({
  name:'Hello World',
  description: 'The nodejs.org example web server.',
  script: 'C:\\path\\to\\helloworld.js',
  logging: {
    mode: 'roll-by-size', 
    sizeThreshold: 10240,    // <--- change this
    keepFiles: 8
  },
  nodeOptions: [
    '--harmony',
    '--max_old_space_size=4096'
  ]
  //, workingDirectory: '...'
  //, allowServiceLogon: true
});

The logging configuration options are passed straight to the winsw XML configuration. You can see more options in the function comments at https://github.com/coreybutler/node-windows/blob/master/lib/winsw.js#L20-L23