1

I am currently adding logs in my application using log4js (not the default sails logger). I'd like to be able to keep track of the server status : when it's up and down. Where should I put the logs to be able to know when the server is down?

Thanks for bringing me out of darkness

krakig
  • 1,515
  • 1
  • 19
  • 33

1 Answers1

2

I didn't test it, but if you want to write a log when the server is shutting down you could try to use the exit event of the process object

var log4js = require('log4js');
process.on('exit', function(code) {
  var logger = log4js.getLogger();
  logger.info("End of the process");
});
Alexis N-o
  • 3,954
  • 26
  • 34