If your application logs a large volume of messages, and find memory usage increasing due to buffering log messages before being written to a file, then you can listen for “log4js:pause” events emitted by the file appenders. Your application should stop logging when it receives one of these events with a value of true and resume when it receives an event with a value of false.
解决思路是在 pinus-logger 里监听 log4js:pause 事件,在 value 为 true 时停止写入,在 value 为 false 时恢复写入
log4js 的文档提到了大量写入的情况下,会有内存泄漏的问题
https://log4js-node.github.io/log4js-node/file.html
解决思路是在 pinus-logger 里监听 log4js:pause 事件,在 value 为 true 时停止写入,在 value 为 false 时恢复写入
参考代码
pinus-logger/lib/logger.ts