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

App doesn't stop when I use this library #155

Open
bmaupin opened this issue Sep 27, 2021 · 4 comments
Open

App doesn't stop when I use this library #155

bmaupin opened this issue Sep 27, 2021 · 4 comments

Comments

@bmaupin
Copy link

bmaupin commented Sep 27, 2021

If I run this code, then it runs and then exits normally:

'use strict';

const { createLogger, transports } = require('winston');

const logger = createLogger({
  transports: [
    new transports.Console(),
  ],
});

logger.error('Test error message, without stack trace');

However, once I use this library my app no longer exits:

'use strict';

const { createLogger, transports } = require('winston');
const Syslog = require('winston-syslog').Syslog;

const logger = createLogger({
  transports: [
    new transports.Console(),
    new Syslog({ port: 5141 })
  ],
});

logger.error('Test error message, without stack trace');

Instead I have to manually exit:

logger.error('Test error message, without stack trace');

setTimeout(() => {
  process.exit();
}, 500);

Here's my node version in case it helps:

$ node --version
v14.17.5

Thanks!

@staticdnweb
Copy link

i got same this issue

bmaupin added a commit to bmaupin/graylog-syslog-examples that referenced this issue Sep 28, 2021
@bmaupin
Copy link
Author

bmaupin commented Sep 29, 2021

I just saw this, which might be interesting to use when trying to figure out why Node isn't exiting: https://github.com/myndzi/wtfnode

@smashah
Copy link

smashah commented Dec 24, 2021

I experienced this today as well. I'm pretty sure this has something to do with event emitters

@wbt
Copy link
Contributor

wbt commented Dec 31, 2021

I encountered this bug and found it to be the same as winstonjs/winston#1706 where I have posted a workaround and a merged PR which fixes it. There's a corresponding small piece which should be addressed before a next release but we are way closer to being able to do that release now than we were even just a few weeks ago.

Try the posted workaround and ideally report back here on if that fixes it. If so, we'll be able to close this issue with the release.

bmaupin added a commit to bmaupin/graylog-syslog-examples that referenced this issue Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants