I have a node js express app hosted on Azure (Microsoft server). For some reason, I get a feeling that the app restarts once in a while, and I want to catch and log this event. So I try this but it doesn't work:
process.on('exit', function (code) {
var exitMsg = 'Process exited with code ' + code;
// log exitMsg synchronously
});
I understand that on Windows there is some problem catching the exit event. Maybe you have some solution? Thanks.