From 2757afb4727dd82d834cdd788d10c162fe4b89f5 Mon Sep 17 00:00:00 2001 From: "sunil.unnava" Date: Mon, 15 Apr 2019 15:49:32 -0400 Subject: set mmagenthome for logs Issue-ID: DMAAP-1139 Change-Id: Ic81c51103b17a0f99390c51b54dbf07100830c34 Signed-off-by: sunil.unnava --- src/main/java/org/onap/dmaap/mr/dmaapMMAgent/MirrorMakerAgent.java | 5 ++--- .../onap/dmaap/mr/dmaapMMAgent/utils/MirrorMakerProcessHandler.java | 2 +- src/main/resources/log4j.properties | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/MirrorMakerAgent.java b/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/MirrorMakerAgent.java index c205440..afab7f6 100644 --- a/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/MirrorMakerAgent.java +++ b/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/MirrorMakerAgent.java @@ -92,11 +92,10 @@ public class MirrorMakerAgent { private boolean checkStartup() { FileInputStream input = null; try { - //this.mmagenthome = System.getProperty("MMAGENTHOME"); input = new FileInputStream(mmagenthome + "/etc/mmagent.config"); logger.info("mmagenthome is set :" + mmagenthome + " loading properties at /etc/mmagent.config"); } catch (IOException ex) { - logger.error(mmagenthome + "/etc/mmagent.config not found. Set -DMMAGENTHOME and check the config file"); + logger.error(mmagenthome + "/etc/mmagent.config not found."); return false; } finally { if (input != null) { @@ -111,7 +110,7 @@ public class MirrorMakerAgent { input = null; try { input = new FileInputStream(kafkahome + "/bin/kafka-run-class.sh"); - logger.info("kakahome is set :" + kafkahome); + logger.info("kafkahome is set :" + kafkahome); } catch (IOException ex) { logger.error(kafkahome + "/bin/kafka-run-class.sh not found. Make sure kafka home is set correctly"); return false; diff --git a/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/utils/MirrorMakerProcessHandler.java b/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/utils/MirrorMakerProcessHandler.java index 9b5f863..a73ac70 100644 --- a/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/utils/MirrorMakerProcessHandler.java +++ b/src/main/java/org/onap/dmaap/mr/dmaapMMAgent/utils/MirrorMakerProcessHandler.java @@ -29,7 +29,7 @@ import org.apache.log4j.Logger; public class MirrorMakerProcessHandler { static final Logger logger = Logger.getLogger(MirrorMakerProcessHandler.class); - static String mmagenthome = System.getProperty("MMAGENTHOME"); + static String mmagenthome = "/opt"; public static boolean checkMirrorMakerProcess(String agentname, boolean enablelogCheck, String grepLog) throws Exception { String line,linelog; diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties index a0ac24f..9225695 100644 --- a/src/main/resources/log4j.properties +++ b/src/main/resources/log4j.properties @@ -30,7 +30,7 @@ log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p - %m # Redirect log messages to a log file, support file rolling. log4j.appender.file=org.apache.log4j.RollingFileAppender -log4j.appender.file.File= ${MMAGENTHOME}/logs/mmagent.log +log4j.appender.file.File= /opt/logs/mmagent.log log4j.appender.file.MaxFileSize=5MB log4j.appender.file.MaxBackupIndex=10 log4j.appender.file.layout=org.apache.log4j.PatternLayout -- cgit 1.2.3-korg