diff --git a/lib/winston/transports/file.js b/lib/winston/transports/file.js index c9ec1d6dc..49edd8b13 100644 --- a/lib/winston/transports/file.js +++ b/lib/winston/transports/file.js @@ -155,11 +155,13 @@ module.exports = class File extends TransportStream { debug('logged %s %s', this._size, output); this.emit('logged', info); - // Do not attempt to rotate files while opening - if (this._opening) { + // Do not attempt to rotate files while rotating + if (this._rotate) { return; } - if (this._rotate) { + + // Do not attempt to rotate files while opening + if (this._opening) { return; }