Closed daveteu closed 2 years ago
Thanks for the heads-up! Seems that this is not unusual to encounter with Winston: https://github.com/winstonjs/winston/issues/1791, https://github.com/winstonjs/winston/issues/1334.
We may be able to mitigate this by not emitting the logged
event, or by some other means, but it doesn't appear that it indicates a bug so in the meantime, should be safe to ignore.
This warning is written when you have many loggers sharing a single transport. The best ways to avoid it is to use a single logger.
i only have one logger. using module.exports = module will mean any require
will use the same instance right?
Thanks for the follow-up, @daveteu - do you mean setting module.exports = <some value>
? I don't think I understand your question properly - any chance you can illustrate with a bit more code showing how you are setting Winston up?
My set up is in the first post. I exported the logger as a module, wouldn't that mean I only have a single logger?
You mentioned
This warning is written when you have many loggers sharing a single transport. The best ways to avoid it is to use a single logger.
@daveteu ah I see š¤ ... yes, that's how I'd expect module exports to work.
i believe my usage is the same as other typical users. Am i the only one with this issue? this is weird.
@daveteu you're definitely not the only one! Unfortunately, the warning seems to appear with all Winston transports, and the exact scenario that triggers it doesn't seem to have been decisively pinned down :-(
There are a lot of threads about this in the Google results for Winston MaxListenersExceededWarning; @liammclennan and I have read as many as we can, but there's still a chance an answer is out there and we've overlooked it - fingers crossed!
We'll keep looking, but if you're able to spot something we've missed, any suggestions/pointers would be great.
I will close this and reopen it if there's any further findings.
Am I the only one getting this error?
I'm using the recommended codes on datalust/seq docs as follow, and I call it this way.
A new listener seems to be created everytime logger is called.
Error
Error occurs about 10 times after
logger.info()
is triggered