foreversd / forever

A simple CLI tool for ensuring that a given script runs continuously (i.e. forever)
http://github.com/foreverjs/forever
MIT License
13.87k stars 946 forks source link

Capturing forever's errors within log file? #766

Open TascSystems opened 9 years ago

TascSystems commented 9 years ago

I posted this at StackOverflow too but I thought it would be useful to also post it here for visibility.

I am currently running forever in a bash script:

forever -v  -l log/system.log -e log/systemerr.log -w --watchIgnore '{log,data,node_modules}' app.js

I am also using log4js to capture logging for my app (with the following configuration):

log4js.configure({
  appenders: [
    //{ type: 'console' },
    {
      type: "file", 
      absolute: true, 
      filename: "./log/app.log", 
      maxLogSize: 1000000,
      backups: 10
    }
  ]}); 

Everything seems to be working in the sense that my app's output is being put out to app.log and forever's -l output is going to system.log:

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms

But the following goes to console and I would have thought it would go to systemerr.log:

error: Could not read .foreverignore file.
error: ENOENT, open '/home/blah/blah/.foreverignore'
error: Forever detected script exited with code: 1
error: Script restart attempt #1

How can I get this error information, which I think is generated by forever, into systemerr.log?

mikeatlas commented 8 years ago

Workaround is to just add an empty .foreverignore in your app's root path.