Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
0004105: Snapshot: use log file names from log4j configuration to filter
files to include in snapshot
  • Loading branch information
philipmarzullo64 committed Oct 1, 2019
1 parent d691e21 commit 5479cdc
Showing 1 changed file with 21 additions and 3 deletions.
Expand Up @@ -415,8 +415,9 @@ public static File createSnapshot(ISymmetricEngine engine) {
logDir = new File("logs");
}

Map<File, Layout> matches = null;
if (!logDir.exists()) {
Map<File, Layout> matches = findSymmetricLogFile();
matches = findSymmetricLogFile();
if (matches != null && matches.size() == 1) {
logDir = matches.keySet().iterator().next().getParentFile();
}
Expand All @@ -436,8 +437,12 @@ public static File createSnapshot(ISymmetricEngine engine) {
if (files != null) {
for (File file : files) {
String lowerCaseFileName = file.getName().toLowerCase();
if (lowerCaseFileName.contains(".log")
&& (lowerCaseFileName.contains("symmetric") || lowerCaseFileName.contains("wrapper"))) {
if (
(lowerCaseFileName.contains(".log")
&& (lowerCaseFileName.contains("symmetric") || lowerCaseFileName.contains("wrapper"))
)
||
compareLogFileName(lowerCaseFileName, matches)) {
try {
FileUtils.copyFileToDirectory(file, tmpDir);
} catch (IOException e) {
Expand All @@ -464,6 +469,19 @@ public static File createSnapshot(ISymmetricEngine engine) {
log.info("Done creating snapshot file");
return jarFile;
}

private static boolean compareLogFileName(String fileName, Map<File, Layout> matches) {
boolean ret = false;
if(fileName != null && fileName.length() > 0 && matches != null && matches.size() > 0) {
for(File f : matches.keySet()) {
if(fileName.toLowerCase().contains(f.getName().toLowerCase())) {
ret = true;
break;
}
}
}
return ret;
}

protected static void extract(DbExport export, File file, String... tables) {
extract(export, Integer.MAX_VALUE, null, file, tables);
Expand Down

0 comments on commit 5479cdc

Please sign in to comment.