Skip to content

Commit

Permalink
[fix] Make logs work again
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki authored and indexzero committed Dec 23, 2011
1 parent d983726 commit 84be160
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/forever/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ var Monitor = exports.Monitor = function (script, options) {
this.options[0] = path.join(this.sourceDir, this.options[0]);
}

this.log = fs.createWriteStream(this.logFile, { flags: 'a+', encoding: 'utf8', mode: '0666' });

// If we should log stdout, open a file buffer
if (this.outFile) {
this.stdout = fs.createWriteStream(this.outFile, { flags: 'a+', encoding: 'utf8', mode: '0666' });
Expand Down Expand Up @@ -170,6 +172,7 @@ Monitor.prototype.start = function (restart) {
// Hook all stream data and process it
function listenTo(stream) {
function ldata(data) {
self.log.write(data);
if (!self.silent && !self[stream]) {
//
// If we haven't been silenced, and we don't have a file stream
Expand Down Expand Up @@ -220,6 +223,8 @@ Monitor.prototype.start = function (restart) {
self.stderr.end();
}

self.log.end();

self.emit('exit', self, spinning);
}

Expand Down

0 comments on commit 84be160

Please sign in to comment.