Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with RotationFileStream #71

Closed
gagle opened this issue Feb 13, 2013 · 1 comment
Closed

Error with RotationFileStream #71

gagle opened this issue Feb 13, 2013 · 1 comment

Comments

@gagle
Copy link

gagle commented Feb 13, 2013

You need to attach an error handler to the stream that you create in line 930.

You need to do the same as 367.

Steps:

Call the EventEmitter constructor in line 928:

EventEmitter.call (this);

Attach an error listener to the stream in line 930:

var self = this;
this.stream = fs.createWriteStream(this.path,
    {flags: 'a', encoding: 'utf8'});
this.stream.on('error', function (err) {
  self.emit('error', err, options);
});

And finally listen to that error on the main logger instance in line 387:

s.stream.on('error', function (err, s) {
    self.emit('error', err, s);
});

Now, if I create a rotation file with an invalid path (e.g. C:/a, EPERM error) the log.on ("error") callback is executed instead of throwing an exception that quits the process.

@trentm
Copy link
Owner

trentm commented Jun 2, 2014

Note to self: when doing this, also make sure to test that "cluster + rotating file ... crash" case cannot be reproduced. IOW, we need to also catch and re-emit the error on mvs from that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants