-
Notifications
You must be signed in to change notification settings - Fork 83
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
Logging for all transport stop if fluent server is not available #115
Comments
Ok, been troubleshooting a bit and here is as far as I can go... With the following 'patch': --- lib/sender.js_orig 2018-10-25 10:55:32.000000000 -0400
+++ lib/sender.js 2018-10-25 11:55:07.000000000 -0400
@@ -106,6 +106,9 @@
this._push(tag, timestamp, data, callback);
this._connect(() => {
this._flushSendQueue();
+ if (this._status !== 'established') {
+ callback && callback();
+ }
});
}
@@ -233,6 +236,7 @@
if (this._socket) {
this._disconnect();
this._handleEvent('error', err);
+ callback();
}
};
this._socket.on('error', errorHandler);
@@ -427,7 +431,13 @@
} else {
this._sendQueueSize -= sendQueueSize;
callbacks.forEach((callback) => {
- callback && callback();
+ try {
+ callback && callback();
+ } catch (err) {
+ console.log("Error occured");
+ console.log(err);
+ }
+
});
process.nextTick(() => {
this._waitToWrite();
Maybe someone can pick it up from here. |
Could you try #116 and nodejs/node#23895 ? |
@okkez with these changes (changes applied to v3.2.1 code) I'm getting an 'Unhandled "error" event' if no fluent server is running:
|
@okkez Sorry had not seen the error handler in your test code. With it I do get the exception:
And on continue on logging to the console. I was able to switch on and off the fluent server multiple times and it would not make the console logging stop. So it looks good to me. |
@okkez regarding the required fix in node... Anyway we could deal with it within the fluent-logger-node library ? The node release cycle is much longer than yours and we can't really wait on them approving the fix and having it make it's way to the next release. Thanks for the quick answer and help. |
It is difficult to handle it in the fluent-logger-node library. |
I am facing a similar issue. I am having two transport in winston ie. file and fluent-logger. Initially few logs are getting saved to my file(via transport), but later when I stop td-agent then logs are not getting saved in a file too. Once I restart td-agent logs are flushed to td-agent and written to file too. I am not able to understand why it's blocking other transport. |
We had this issue in our project and I fixed it. Just now, I made a pull request for it.I will leave the link to it below. If you have the same problem you can use my fork. I would very much appreciate it, if anyone could review it for merging. |
In the case where the fluent server becomes unavailable the logging for all transports stop logging and not only the fluent one.
I was able to reproduce this with a slightly modified version of the
winston
example:Running this without any fluent listening on port 24224 will cause even the console log to stop after 16 loop.
If a fluent server is listening (or emulated with
nc -lv 24224
) it keeps on going till I stop the fluent server and then it keep on logging on the console for 16 loops and then stops logging. Restarting the fluent server does not make the logging (console and fluent) start again.The text was updated successfully, but these errors were encountered: