I have an IoT project running on a Raspberry Pi 2 using Raspbian Jessie OS.
This is a web server running in NodeJS (v4), and I use Winston to log into the Loggly logging service. Everything works well when the project starts via npm start from the terminal (when launched as "pi" or via sudo -s). However, when the project starts at startup, logging does not work, and I cannot understand why.
To start the project at startup, I created the etc / init.d script file. The project starts and serves traffic, everything works fine, except for registration. I see no errors (although registration failed). This is how I run my project from my etc / init.d script:
/usr/bin/node /var/www/curtains/server.js
I use winston: https://www.npmjs.com/package/winston and winston-loggly: https://www.npmjs.com/package/winston-loggly .
Any ideas why registration does not work when starting the process at boot?
Adding winston initialization code as requested:
var winston = require('winston'); require('winston-loggly'); winston.add(winston.transports.Loggly, { token: "<snip>", subdomain: "<snip>", tags: ["tag", ip.address()], json:true }); winston.log('info',"Server.js starting up");
source share