From e0fb5d927fe0941b431b634c92e845e7af63fe23 Mon Sep 17 00:00:00 2001 From: Mikhail T Date: Tue, 5 Dec 2017 11:42:14 -0500 Subject: [PATCH 1/7] Add signal-handling to allow proper log-rotation. --- src/lib/logger.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/logger.js b/src/lib/logger.js index dd8bac2ee..3d777bf40 100644 --- a/src/lib/logger.js +++ b/src/lib/logger.js @@ -93,6 +93,10 @@ function setup(logs) { }, }); + process.on('SIGUSR2', function () { + log.reopenFileStreams(); + }); + module.exports.logger = logger; } From 717ef38c0c69bd58cfe22e3d52aabc173177dca4 Mon Sep 17 00:00:00 2001 From: Mikhail T Date: Tue, 5 Dec 2017 11:46:48 -0500 Subject: [PATCH 2/7] Document SIGUSR2 as the means of notifying the running process, it needs to reopen the log. --- wiki/logger.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wiki/logger.md b/wiki/logger.md index 97536dbb0..3ab58554f 100644 --- a/wiki/logger.md +++ b/wiki/logger.md @@ -10,6 +10,8 @@ logs: - {type: file, path: verdaccio.log, level: info} ``` +Use `SIGUSR2` to notify the application, the log-file was rotated and it needs to reopen it. + ### Configuration Property | Type | Required | Example | Support | Description From 10a49e439ce1a5a5279f2223247cf47d6d1e85d5 Mon Sep 17 00:00:00 2001 From: Mikhail T Date: Tue, 5 Dec 2017 12:03:18 -0500 Subject: [PATCH 3/7] Try to appease lint --- src/lib/logger.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/logger.js b/src/lib/logger.js index 3d777bf40..5b2b38f92 100644 --- a/src/lib/logger.js +++ b/src/lib/logger.js @@ -93,8 +93,8 @@ function setup(logs) { }, }); - process.on('SIGUSR2', function () { - log.reopenFileStreams(); + process.on('SIGUSR2', function() { + Logger.reopenFileStreams(); }); module.exports.logger = logger; From b7228a36b60d9ceaea968ab177936592d677c12b Mon Sep 17 00:00:00 2001 From: Mikhail T Date: Tue, 5 Dec 2017 12:15:52 -0500 Subject: [PATCH 4/7] Document the fix to log-rotation --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efacb3dd4..6697c0672 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. See [standa ### Bug Fixes * :bug: incorrect logo url with slash at the end of `url_prefix` ([859eccb](https://github.com/verdaccio/verdaccio/commit/859eccb)) - +* :fix: Log-rotation used to require a full restart of the application. Now `SIGUSR2` can be used to ask the process to reopen the log. From eb9f10f9783dca72f9fdae209dae2bf1125b4806 Mon Sep 17 00:00:00 2001 From: Mikhail T Date: Tue, 5 Dec 2017 12:18:26 -0500 Subject: [PATCH 5/7] Use "bug" instead of "fix" to get the cute green icon --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6697c0672..84aba389e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. See [standa ### Bug Fixes * :bug: incorrect logo url with slash at the end of `url_prefix` ([859eccb](https://github.com/verdaccio/verdaccio/commit/859eccb)) -* :fix: Log-rotation used to require a full restart of the application. Now `SIGUSR2` can be used to ask the process to reopen the log. +* :bug: Log-rotation used to require a full restart of the application. Now `SIGUSR2` can be used to ask the process to reopen the log. From baa4763a248053347c7648c067ee883eae37a61d Mon Sep 17 00:00:00 2001 From: Mikhail T Date: Tue, 5 Dec 2017 12:29:24 -0500 Subject: [PATCH 6/7] :bug: Log-rotation used to require a full restart of the application. Now `SIGUSR2` can be used to ask the process to reopen the log. Revert "Use "bug" instead of "fix" to get the cute green icon" This reverts commit eb9f10f9783dca72f9fdae209dae2bf1125b4806. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84aba389e..6697c0672 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. See [standa ### Bug Fixes * :bug: incorrect logo url with slash at the end of `url_prefix` ([859eccb](https://github.com/verdaccio/verdaccio/commit/859eccb)) -* :bug: Log-rotation used to require a full restart of the application. Now `SIGUSR2` can be used to ask the process to reopen the log. +* :fix: Log-rotation used to require a full restart of the application. Now `SIGUSR2` can be used to ask the process to reopen the log. From b0960f3fb9ade4ead7a503a49c0ead8859ed3e5d Mon Sep 17 00:00:00 2001 From: Mikhail T Date: Tue, 5 Dec 2017 12:29:47 -0500 Subject: [PATCH 7/7] Revert "Document the fix to log-rotation" This reverts commit b7228a36b60d9ceaea968ab177936592d677c12b. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6697c0672..efacb3dd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. See [standa ### Bug Fixes * :bug: incorrect logo url with slash at the end of `url_prefix` ([859eccb](https://github.com/verdaccio/verdaccio/commit/859eccb)) -* :fix: Log-rotation used to require a full restart of the application. Now `SIGUSR2` can be used to ask the process to reopen the log. +