X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=datarouter-node%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fnode%2FStatusLog.java;h=2e646043913aa852a1587779419adff7f8aa5ec3;hb=6c78b3e6a0a67c73f931337356a172cc69cee0e8;hp=53e53145846065eb4fe272043518d06fba1fcae7;hpb=56bef7eb388a5783ec27e7d641ea3e0f64e7abbd;p=dmaap%2Fdatarouter.git diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java index 53e53145..2e646043 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/StatusLog.java @@ -46,6 +46,7 @@ public class StatusLog { private static StatusLog instance = new StatusLog(); private SimpleDateFormat filedate = new SimpleDateFormat("-yyyyMMddHHmm"); + private String prefix = "logs/events"; private String suffix = ".log"; private String plainfile; @@ -158,6 +159,8 @@ public class StatusLog { instance.log( "PUB|" + pubid + "|" + feedid + "|" + requrl + "|" + method + "|" + ctype + "|" + clen + "|" + srcip + "|" + user + "|" + status); + eelfLogger.info("PUB|" + pubid + "|" + feedid + "|" + requrl + "|" + method + "|" + ctype + "|" + + clen + "|" + srcip + "|" + user + "|" + status); } /** @@ -178,6 +181,8 @@ public class StatusLog { long rcvd, String srcip, String user, String error) { instance.log("PBF|" + pubid + "|" + feedid + "|" + requrl + "|" + method + "|" + ctype + "|" + clen + "|" + rcvd + "|" + srcip + "|" + user + "|" + error); + eelfLogger.info("PBF|" + pubid + "|" + feedid + "|" + requrl + "|" + method + "|" + ctype + "|" + clen + + "|" + rcvd + "|" + srcip + "|" + user + "|" + error); } /** @@ -202,6 +207,8 @@ public class StatusLog { instance.log( "DEL|" + pubid + "|" + feedid + "|" + subid + "|" + requrl + "|" + method + "|" + ctype + "|" + clen + "|" + user + "|" + status + "|" + xpubid); + eelfLogger.info("DEL|" + pubid + "|" + feedid + "|" + subid + "|" + requrl + "|" + method + "|" + + ctype + "|" + clen + "|" + user + "|" + status + "|" + xpubid); } /** @@ -225,6 +232,8 @@ public class StatusLog { instance.log( "EXP|" + pubid + "|" + feedid + "|" + subid + "|" + requrl + "|" + method + "|" + ctype + "|" + clen + "|" + reason + "|" + attempts); + eelfLogger.info("EXP|" + pubid + "|" + feedid + "|" + subid + "|" + requrl + "|" + method + "|" + + ctype + "|" + clen + "|" + reason + "|" + attempts); } /** @@ -242,6 +251,7 @@ public class StatusLog { return; } instance.log("DLX|" + pubid + "|" + feedid + "|" + subid + "|" + clen + "|" + sent); + eelfLogger.info("DLX|" + pubid + "|" + feedid + "|" + subid + "|" + clen + "|" + sent); } private synchronized void checkRoll(long now) throws IOException { @@ -256,7 +266,7 @@ public class StatusLog { nexttime = now - now % intvl + intvl; curfile = prefix + filedate.format(new Date(nexttime - intvl)) + suffix; plainfile = prefix + suffix; - notify(); + notifyAll(); } } @@ -266,7 +276,7 @@ public class StatusLog { checkRoll(now); if (os == null) { os = new FileOutputStream(curfile, true); - (new File(plainfile)).delete(); + Files.deleteIfExists(new File(plainfile).toPath()); Files.createLink(Paths.get(plainfile), Paths.get(curfile)); } os.write((NodeUtils.logts(new Date(now)) + '|' + string + '\n').getBytes());