You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2019/05/09 13:59:46 UTC

[geode] branch develop updated: GEODE-6707 gfsh export logs will now export rolled over gc logs (#3543)

This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 3c87c17  GEODE-6707 gfsh export logs will now export rolled over gc logs (#3543)
3c87c17 is described below

commit 3c87c1771c873f68f888e987674243d9e3c51fa1
Author: Srikanth Manvi <sm...@pivotal.io>
AuthorDate: Thu May 9 09:59:21 2019 -0400

    GEODE-6707 gfsh export logs will now export rolled over gc logs (#3543)
---
 .../internal/cli/util/LogExporterFileIntegrationTest.java  | 14 ++++++++++++++
 .../geode/management/internal/cli/util/LogExporter.java    |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/cli/util/LogExporterFileIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/cli/util/LogExporterFileIntegrationTest.java
index c1718a0..418622b 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/cli/util/LogExporterFileIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/cli/util/LogExporterFileIntegrationTest.java
@@ -134,4 +134,18 @@ public class LogExporterFileIntegrationTest {
     assertThat(logExporter.findStatFiles(workingDir.toPath())).contains(statFile.toPath());
     assertThat(logExporter.findStatFiles(workingDir.toPath())).doesNotContain(notALogFile.toPath());
   }
+
+  @Test
+  // GEODE-6707 - Rolled over GC logs end with names like ".log.1"
+  public void findLogsWhichContainsTheWordLog() throws Exception {
+    File gcLogFile = new File(workingDir, "gc.log");
+    FileUtils.writeStringToFile(gcLogFile, "some gc log line");
+
+    File gcRolledOverLogFile = new File(workingDir, "gc.log.1");
+    FileUtils.writeStringToFile(gcRolledOverLogFile, "some gc log line");
+
+    assertThat(logExporter.findLogFiles(workingDir.toPath())).contains(gcLogFile.toPath());
+    assertThat(logExporter.findLogFiles(workingDir.toPath()))
+        .contains(gcRolledOverLogFile.toPath());
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogExporter.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogExporter.java
index aafc72c..96f395a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogExporter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogExporter.java
@@ -169,7 +169,7 @@ public class LogExporter {
   }
 
   List<Path> findLogFiles(Path workingDir) throws IOException {
-    Predicate<Path> logFileSelector = (Path file) -> file.toString().toLowerCase().endsWith(".log");
+    Predicate<Path> logFileSelector = (Path file) -> file.toString().toLowerCase().contains(".log");
     return findFiles(workingDir, logFileSelector);
   }