I am very happy with logging using npm module morgan but not sure how to log system crash or system shutdown in node application. Is it possible? Please guide.
Thanks
I am very happy with logging using npm module morgan but not sure how to log system crash or system shutdown in node application. Is it possible? Please guide.
Thanks
Copyright © 2021 Jogjafile Inc.
You can use the Process API to watch for uncaught exceptions.
For a detailed explanation check this answer to a similar question here on Stack Overflow. There's also this great blog post: https://shapeshed.com/uncaught-exceptions-in-node/.
As an extra, check this other one to send emails with the crash information: https://coderwall.com/p/4yis4w/node-js-uncaught-exceptions