From 31a1bf2c005c9b84622c2c74aba3727abf617387 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Wed, 20 Apr 2022 08:23:21 +0200 Subject: [PATCH 1/3] DynamicPolicy should continue existing file When a job is run every minute, the log file should contain more than just the logs of the last execution. --- .../src/main/java/org/tinylog/policies/DynamicPolicy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinylog-impl/src/main/java/org/tinylog/policies/DynamicPolicy.java b/tinylog-impl/src/main/java/org/tinylog/policies/DynamicPolicy.java index 8eae67573..3d51a6c92 100644 --- a/tinylog-impl/src/main/java/org/tinylog/policies/DynamicPolicy.java +++ b/tinylog-impl/src/main/java/org/tinylog/policies/DynamicPolicy.java @@ -41,7 +41,7 @@ public DynamicPolicy(final String argument) { @Override public boolean continueExistingFile(final String path) { - return !reset; + return true; } @Override From c762510ded3bfab010b443d498ec51c70917d4f9 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Thu, 21 Apr 2022 08:42:47 +0200 Subject: [PATCH 2/3] Fix DynamicPolicyTest.discontinueExistingFile --- .../src/test/java/org/tinylog/policies/DynamicPolicyTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java b/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java index 8c65d56f1..5585f39bd 100644 --- a/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java +++ b/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java @@ -47,7 +47,7 @@ public void discontinueExistingFile() throws IOException { assertThat(policy.continueExistingFile(file)).isTrue(); DynamicPolicy.setReset(); - assertThat(policy.continueExistingFile(file)).isFalse(); + assertThat(policy.continueExistingFile(file)).isTrue(); policy.reset(); assertThat(policy.continueExistingFile(file)).isTrue(); From ebf38b048c9bc00e737b3d942c575b170ca07936 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Thu, 21 Apr 2022 10:18:54 +0200 Subject: [PATCH 3/3] Fix DynamicPolicyTest.continueCurrentFile --- .../src/test/java/org/tinylog/policies/DynamicPolicyTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java b/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java index 5585f39bd..9894d9760 100644 --- a/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java +++ b/tinylog-impl/src/test/java/org/tinylog/policies/DynamicPolicyTest.java @@ -35,13 +35,13 @@ public final class DynamicPolicyTest { public final SystemStreamCollector systemStream = new SystemStreamCollector(true); /** - * Verifies that an existing log file can be continued until triggering a manual reset. + * Verifies that an existing log file will always be continued. * * @throws IOException * Failed creating temporary file */ @Test - public void discontinueExistingFile() throws IOException { + public void continueExistingFile() throws IOException { String file = FileSystem.createTemporaryFile(); DynamicPolicy policy = new DynamicPolicy(null); assertThat(policy.continueExistingFile(file)).isTrue();