-
Notifications
You must be signed in to change notification settings - Fork 518
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
Rotating-file stream prevent process from exiting. #97
Conversation
Test case: https://gist.github.com/chakrit/6280041
|
whoops, hit the wrong button, sry. |
The rotation `setTimeout` from `RotatingFileStream` will prevent the process from exiting. This fix simply `unref()` the timeout immediately after it is set.
Found the solution, turns out it is simply because of the rotation Possibly also fix #73 as well but I havn't tested. |
@trentm any chance of this getting merged anytime soon? |
Will fail if any timers or callbacks remain registered when instantiating a logger with a rotating file.
Thanks very much for finding the root issue here. I apologize for taking so long to get to this. This will be in bunyan 0.23.1. |
Hrm, the unref addition in the PR only fixes this for node 0.10. Node 0.8.x doesn't have unref on setTimeout results. I'll add a warning about rotating-file support for node 0.8. |
wow, that's a very long time! anyway glad it's finally fixed for good : ) awesome library btw. |
Related: #73
If I
bunyan.createLogger
with atype: "rotating-file"
, my process will not exits.I've tried the solution in #73 but it does not work and my CLI program stays running even though it doesn't do anything.
Removing the rotating-file logger causes my very trivial program to exit cleanly.
Is there a way to force the logger to close all streams?
This is also very problematic in tests as having a component using the rotating-file logger means the test will not cleanup properly or the test runner may not exit and hangs the CI :/