Justin Young
Justin Young

Reputation: 2463

How to write node errors to stderr

I'm running a node app via a shell script

#STARTUP.sh
node server.js

#/etc/rc.local  - this runs on startup of my machine
sudo sh startup.sh >> /home/pi/logs/app.log 2>&1

My issue is, when I have an error in my node app it just crashes and doesn't write the error to app.log

Is there a way to make sure when the app crashes that the error gets logged as well?

Upvotes: 0

Views: 130

Answers (1)

Coder-256
Coder-256

Reputation: 5618

Replace the last line with this:

sudo sh startup.sh &>>/home/pi/logs/app.log

Upvotes: 1

Related Questions