0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

fix: fatal exception and crash when log rotate signal event is called (#1774)

fix #1709
This commit is contained in:
Juan Picado @jotadeveloper 2020-04-10 17:36:29 +02:00 committed by GitHub
parent 4cf61d6e8c
commit 1a9a12e918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -150,7 +150,15 @@ function setup(logs, { logStart } = { logStart: true }) {
}
process.on('SIGUSR2', function() {
Logger.reopenFileStreams();
// https://github.com/trentm/node-bunyan#stream-type-rotating-file
if (logger) {
/**
* Note on log rotation: Often you may be using external log rotation utilities like logrotate on Linux or logadm
* on SmartOS/Illumos. In those cases, unless your are ensuring "copy and truncate" semantics
* (via copytruncate with logrotate or -c with logadm) then the fd for your 'file' stream will change.
*/
logger.reopenFileStreams();
}
});
}