Skip to content

Commit

Permalink
minor tidying up
Browse files Browse the repository at this point in the history
  • Loading branch information
vargm committed Feb 6, 2025
1 parent d601c6a commit c32b6ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/pega/gcs/logviewer/LogViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public class LogViewer extends BaseFrame {
// GCP GOC file pattern
private static final String GCP_GOC_FILE_NAME_REGEX = "^\\d+$";

public static final String GCP_GOC_FILE_SUFFIX_RULES = "GCP-PegaRULES";

public static final String GCP_GOC_FILE_SUFFIX_ALERT = "GCP-PegaRULES-ALERT";
/* ================================== */

private String appName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.swing.SwingWorker;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;

import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.type.TypeReference;
Expand All @@ -26,10 +27,6 @@ public class GcpGocLogPreprocessorTask extends SwingWorker<List<File>, Integer>

private static final Log4j2Helper LOG = new Log4j2Helper(GcpGocLogPreprocessorTask.class);

private static final String FILE_SUFFIX_RULES = "GCP-PegaRULES.log";

private static final String FILE_SUFFIX_ALERT = "GCP-PegaRULES-ALERT.log";

private static final String PEGA_TOMCAT_CONTAINER = "pega-web-tomcat";

private File gcpGocLogFile;
Expand Down Expand Up @@ -64,10 +61,12 @@ protected List<File> doInBackground() throws Exception {

File gcpGocLogFile = getGcpGocLogFile();
File baseFolder = gcpGocLogFile.getParentFile();
String baseFileName = gcpGocLogFile.getName();
String baseFileName = FilenameUtils.getBaseName(gcpGocLogFile.getName());
String rulesFileName = baseFileName + "-" + LogViewer.GCP_GOC_FILE_SUFFIX_RULES + ".json";
String alertFileName = baseFileName + "-" + LogViewer.GCP_GOC_FILE_SUFFIX_ALERT + ".json";

File pegaRulesLogFile = new File(baseFolder, baseFileName + "-" + FILE_SUFFIX_RULES);
File pegaAlertLogFile = new File(baseFolder, baseFileName + "-" + FILE_SUFFIX_ALERT);
File pegaRulesLogFile = new File(baseFolder, rulesFileName);
File pegaAlertLogFile = new File(baseFolder, alertFileName);

int totalLineCount = 0;

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/pega/gcs/logviewer/parser/LogParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.pega.gcs.fringecommon.log4j2.Log4j2Helper;
import com.pega.gcs.fringecommon.utilities.DateTimeUtilities;
import com.pega.gcs.logviewer.LogViewer;
import com.pega.gcs.logviewer.logfile.AbstractLogPattern;
import com.pega.gcs.logviewer.logfile.AbstractLogPattern.LogType;
import com.pega.gcs.logviewer.logfile.AlertLogPattern;
Expand Down Expand Up @@ -331,7 +332,7 @@ public static LogParser getLogParser(String filename, List<String> readLineList,

Log4jPatternManager log4jPatternManager = Log4jPatternManager.getInstance();

if (filename.toUpperCase().contains("GCP-PegaRULES-ALERT")) {
if (filename.toUpperCase().contains(LogViewer.GCP_GOC_FILE_SUFFIX_ALERT.toUpperCase())) {

AlertLogPattern alertLogPattern = LogPatternFactory.getInstance().getAlertLogPattern();

Expand Down Expand Up @@ -389,7 +390,7 @@ public static LogParser getLogParser(String filename, List<String> readLineList,
Set<Log4jPattern> log4jPatternSet = log4jPatternManager.getDefaultPegaCloudKAccessLog4jPatternSet();

logParser = getLog4jParser(readLineList, log4jPatternSet, charset, locale, displayZoneId);
} else if ((filename.toUpperCase().contains("GCP-PEGARULES"))) {
} else if ((filename.toUpperCase().contains(LogViewer.GCP_GOC_FILE_SUFFIX_RULES.toUpperCase()))) {

JsonLogParser jsonLogParser = new JsonLogParser(charset, locale, displayZoneId);

Expand Down

0 comments on commit c32b6ac

Please sign in to comment.