Got MaxListenersExceededWarning while using winston.
See original GitHub issueI got a warning message while using winston@3.0.0-rc5
after calling the createLogger
function multiple times in my test cases.
(node:28754) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit
at _addListener (events.js:280:19)
at DerivedLogger.addListener (events.js:297:10)
at DerivedLogger.Readable.on (_stream_readable.js:772:35)
at DerivedLogger.once (events.js:341:8)
at DerivedLogger.Readable.pipe (_stream_readable.js:580:9)
at DerivedLogger.add (/Users/NS/yk/node_modules/winston/lib/winston/logger.js:299:8)
at DerivedLogger.<anonymous> (/Users/NS/yk/node_modules/winston/lib/winston/logger.js:82:12)
at Array.forEach (<anonymous>)
at DerivedLogger.Logger.configure (/Users/NS/yk/node_modules/winston/lib/winston/logger.js:81:24)
at DerivedLogger.Logger (/Users/NS/yk/node_modules/winston/lib/winston/logger.js:22:8)
at new DerivedLogger (/Users/NS/yk/node_modules/winston/lib/winston/create-logger.js:24:44)
at Object.module.exports [as createLogger] (/Users/NS/yk/node_modules/winston/lib/winston/create-logger.js:58:10)
Issue Analytics
- State:
- Created 5 years ago
- Comments:23 (12 by maintainers)
Top Results From Across the Web
node.js - Winston - MaxListenersExceededWarning: Possible ...
when one creates a lot of logger instances using transport. ... it got fixed by calling winstonLoggerInstance.clear() when I was done with ......
Read more >winstonjs/winston - Gitter
Hi, I've recently been getting this warning (node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unpipe listeners added ...
Read more >Possible EventEmitter memory leak detected-node.js
Coding example for the question Winston - MaxListenersExceededWarning: ... it got fixed by calling winstonLoggerInstance.clear() when I was done with the ...
Read more >EventEmitter Memory Leak Issue : r/node - Reddit
I am running into an issue when developing a node REST api. I am using NextJS and winston for logging. I think the...
Read more >Understanding memory leaks in node.js part 2 - alxolr
In the second part, we will focus on event emitters and cached objects. ... (node:10031) MaxListenersExceededWarning: Possible EventEmitter memory leak ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Problem still exists for DailyRotateFile. Code above is enough to reproduce issue.
Yep. My case: I’m trying to label messages from different modules with winston 3.0, e.g.
[DB] Connected ok
,[Main] Server started ok
. So what i want to do, is simple call on the top of file, like this:const logger = createNamedLogger('Main');
, wherecreateNamedLogger
is my wrapper to create logger with labeled Console and File transports.I tried to find easy way to do such trivial thing, but i did not found it in docs.