-
Notifications
You must be signed in to change notification settings - Fork 3
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
smtpAppender error unhandled when no network present #19
Comments
Related to log4js-node/log4js-node#575 - needs a standard way of handling appender errors |
I have a similar situation with the TCP appender. I'm using it as an optional appender, in parallel with console, for developers working on a multi-server application. They might be running it, or maybe not. Or they may change the log4js configuration on the tcp-server, which would trigger a restart, and temporarily broken connections. It would be nice to have an option to let the logging apps keep on running in the face of TCP connection failures. I was thinking along the lines of a callback that was passed the appender, which could decide whether to ignore the error, throw it, or maybe retry the write operation, or disable the appender. |
|
The original issue of the stmpAppender might need to be transferred to https://github.com/log4js-node/smtp. |
@peteriman good call. |
Background from Node.js
Proposed fix:A fix would be to add an Line 40 in 2b122dd
=L40 const transport = mailer.createTransport(getTransportOptions(config));
+L41 transport.on('error', (e) => {}); // replace with code for error handling Reference details:Due to nodemailer's class Mail extends EventEmitter { https://github.com/nodemailer/nodemailer/blob/master/lib/mailer/index.js#L23 // transporter errors
this.transporter.on('error', err => {
this.logger.error(
{
err,
tnx: 'transport'
},
'Transport Error: %s',
err.message
);
this.emit('error', err);
}); https://github.com/nodemailer/nodemailer/blob/master/lib/mailer/index.js#L73-L84 |
Is it expected for the log4js to quit the process with the following:
log4js.smtpAppender - Error happened { [Error: getaddrinfo ENOTFOUND smtp.gmail.com]
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'smtp.gmail.com' }
The text was updated successfully, but these errors were encountered: