aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-node/src/main/java/org/onap
diff options
context:
space:
mode:
authorEmmettCox <emmett.cox@est.tech>2019-04-08 10:34:31 +0000
committerConor Ward <conor.ward@est.tech>2019-04-08 15:49:44 +0000
commitb60213dc26540543f500b3442b061565907c3cf8 (patch)
tree3d40d1853ed1c545103bbe28cac504d1fa9e704c /datarouter-node/src/main/java/org/onap
parent0fa019897cb79de1def349b8fd0b660d1951681a (diff)
update DR logging to log under one system
Change-Id: I7e21a9c698e49601b090cee350c5a5cc7deb8315 Issue-ID: DMAAP-1050 Signed-off-by: EmmettCox <emmett.cox@est.tech>
Diffstat (limited to 'datarouter-node/src/main/java/org/onap')
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java13
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java5
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java16
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java11
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java6
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java50
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java10
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java140
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java17
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java8
10 files changed, 134 insertions, 142 deletions
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java
index b0122596..30ad1618 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DRNodeCadiFilter.java
@@ -19,7 +19,8 @@
*/
package org.onap.dmaap.datarouter.node;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.filter.CadiFilter;
@@ -33,7 +34,7 @@ import java.io.IOException;
public class DRNodeCadiFilter extends CadiFilter {
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeServlet");
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(NodeServlet.class);
DRNodeCadiFilter(boolean init, PropAccess access) throws ServletException {
super(init, access);
@@ -69,11 +70,11 @@ public class DRNodeCadiFilter extends CadiFilter {
HttpServletResponse resp = (HttpServletResponse) response;
String fileid = req.getPathInfo();
if (fileid == null) {
- logger.info("NODE0105 Rejecting bad URI for PUT " + req.getPathInfo() + " from " + req.getRemoteAddr());
+ logger.error("NODE0105 Rejecting bad URI for PUT " + req.getPathInfo() + " from " + req.getRemoteAddr());
try {
resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Invalid request URI. Expecting <feed-publishing-url>/<fileid>.");
} catch (IOException e) {
- logger.error("NODE0541 DRNodeCadiFilter.getFeedId: ", e);
+ logger.error("NODE0541 DRNodeCadiFilter.getFeedId: ", e.getMessage());
}
return null;
}
@@ -83,11 +84,11 @@ public class DRNodeCadiFilter extends CadiFilter {
fileid = fileid.substring(9);
int i = fileid.indexOf('/');
if (i == -1 || i == fileid.length() - 1) {
- logger.info("NODE0105 Rejecting bad URI for PUT (publish) of " + req.getPathInfo() + " from " + req.getRemoteAddr());
+ logger.error("NODE0105 Rejecting bad URI for PUT (publish) of " + req.getPathInfo() + " from " + req.getRemoteAddr());
try {
resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Invalid request URI. Expecting <feed-publishing-url>/<fileid>. Possible missing fileid.");
} catch (IOException e) {
- logger.error("NODE0542 DRNodeCadiFilter.getFeedId: ", e);
+ logger.error("NODE0542 DRNodeCadiFilter.getFeedId: ", e.getMessage());
}
return null;
}
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java
index d2600d23..501e489c 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/Delivery.java
@@ -26,7 +26,8 @@ package org.onap.dmaap.datarouter.node;
import java.util.*;
import java.io.*;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
/**
* Main control point for delivering files to destinations.
@@ -41,7 +42,7 @@ import org.apache.log4j.Logger;
* that queue has more files to deliver.
*/
public class Delivery {
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.Delivery");
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(Delivery.class);
private static class DelItem implements Comparable<DelItem> {
private String pubid;
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java
index 46c46675..cca61707 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java
@@ -31,7 +31,6 @@ import java.util.zip.GZIPInputStream;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Logger;
import org.onap.dmaap.datarouter.node.eelf.EelfMsgs;
import org.slf4j.MDC;
@@ -46,8 +45,7 @@ import static org.onap.dmaap.datarouter.node.NodeUtils.isFiletypeGzip;
* the file and its delivery data as well as to attempt delivery.
*/
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
- private static Logger loggerDeliveryTask = Logger.getLogger("org.onap.dmaap.datarouter.node.DeliveryTask");
- private static EELFLogger eelflogger = EELFManager.getInstance()
+ private static EELFLogger eelfLogger = EELFManager.getInstance()
.getLogger(DeliveryTask.class);
private DeliveryTaskHelper deliveryTaskHelper;
private String pubid;
@@ -129,7 +127,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
hdrv.add(new String[]{h, v});
}
} catch (Exception e) {
- loggerDeliveryTask.error("Exception "+ Arrays.toString(e.getStackTrace()), e);
+ eelfLogger.error("Exception "+ Arrays.toString(e.getStackTrace()), e.getMessage());
}
hdrs = hdrv.toArray(new String[hdrv.size()][]);
url = deliveryTaskHelper.getDestURL(fileid);
@@ -249,7 +247,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
}
deliveryTaskHelper.reportStatus(this, rc, xpubid, rmsg);
} catch (Exception e) {
- loggerDeliveryTask.error("Exception " + Arrays.toString(e.getStackTrace()), e);
+ eelfLogger.error("Exception "+ Arrays.toString(e.getStackTrace()),e);
deliveryTaskHelper.reportException(this, e);
}
}
@@ -274,7 +272,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
outputStream.close();
} catch (IOException e) {
httpURLConnection.setRequestProperty("Decompression_Status", "FAILURE");
- loggerDeliveryTask.info("Could not decompress file");
+ eelfLogger.info("Could not decompress file");
sendFile(httpURLConnection);
}
@@ -328,7 +326,7 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
} catch (ProtocolException pe) {
deliveryTaskHelper.reportDeliveryExtra(this, -1L);
// Rcvd error instead of 100-continue
- loggerDeliveryTask.error("Exception " + Arrays.toString(pe.getStackTrace()), pe);
+ eelfLogger.error("Exception " + Arrays.toString(pe.getStackTrace()), pe);
}
return outputStream;
}
@@ -339,8 +337,8 @@ public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
void clean() {
datafile.delete();
metafile.delete();
- eelflogger.info(EelfMsgs.INVOKE, newInvocationId);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.INVOKE, newInvocationId);
+ eelfLogger.info(EelfMsgs.EXIT);
hdrs = null;
}
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java
index b8db0309..f7cedd22 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/IsFrom.java
@@ -24,7 +24,8 @@
package org.onap.dmaap.datarouter.node;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.io.IOException;
import java.util.*;
@@ -37,7 +38,7 @@ public class IsFrom {
private long nextcheck;
private String[] ips;
private String fqdn;
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.IsFrom");
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(IsFrom.class);
/**
* Configure the JVM DNS cache to have a 10 second TTL. This needs to be called very very early or it won't have any effect.
@@ -70,7 +71,7 @@ public class IsFrom {
hostAddrArray.add(addr.getHostAddress());
}
} catch (UnknownHostException e) {
- logger.debug("IsFrom: UnknownHostEx: " + e.toString(), e);
+ logger.error("IsFrom: UnknownHostEx: " + e.toString(), e.getMessage());
}
ips = hostAddrArray.toArray(new String[0]);
logger.info("IsFrom: DNS ENTRIES FOR FQDN " + fqdn + " : " + Arrays.toString(ips));
@@ -89,9 +90,9 @@ public class IsFrom {
return true;
}
} catch (UnknownHostException e) {
- logger.debug("IsFrom: UnknownHostEx: " + e.toString(), e);
+ logger.error("IsFrom: UnknownHostEx: " + e.toString(), e.getMessage());
} catch (IOException e) {
- logger.debug("IsFrom: Failed to parse IP : " + ip + " : " + e.toString(), e);
+ logger.error("IsFrom: Failed to parse IP : " + ip + " : " + e.toString(), e.getMessage());
}
return false;
}
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java
index 791eee12..23512a14 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java
@@ -24,12 +24,14 @@
package org.onap.dmaap.datarouter.node;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Vector;
-import org.apache.log4j.Logger;
/**
* Processed configuration for this node.
@@ -39,7 +41,7 @@ import org.apache.log4j.Logger;
* discarded.
*/
public class NodeConfig {
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeConfig");
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(NodeConfig.class);
/**
* Raw configuration entry for a data router node
*/
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java
index 8011c632..feee19c1 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java
@@ -26,8 +26,6 @@ package org.onap.dmaap.datarouter.node;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Logger;
-import org.onap.aaf.cadi.PropAccess;
import org.onap.dmaap.datarouter.node.eelf.EelfMsgs;
import java.io.File;
@@ -43,7 +41,7 @@ import java.util.Timer;
* Maintain the configuration of a Data Router node
* <p>
* The NodeConfigManager is the single point of contact for servlet, delivery, event logging, and log retention
- * subsystems to access configuration information. (Log4J has its own configuration mechanism).
+ * subsystems to access configuration information.
* <p>
* There are two basic sets of configuration data. The static local configuration data, stored in a local configuration
* file (created as part of installation by SWM), and the dynamic global configuration data fetched from the data router
@@ -51,9 +49,8 @@ import java.util.Timer;
*/
public class NodeConfigManager implements DeliveryQueueHelper {
- private static EELFLogger eelflogger = EELFManager.getInstance()
+ private static EELFLogger eelfLogger = EELFManager.getInstance()
.getLogger(NodeConfigManager.class);
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeConfigManager");
private static NodeConfigManager base = new NodeConfigManager();
private Timer timer = new Timer("Node Configuration Timer", true);
@@ -119,14 +116,12 @@ public class NodeConfigManager implements DeliveryQueueHelper {
Properties drNodeProperties = new Properties();
try {
- logger.info("NODE0301 Loading local config file node.properties");
+ eelfLogger.info("NODE0301 Loading local config file node.properties");
drNodeProperties.load(new FileInputStream(System
.getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties")));
} catch (Exception e) {
NodeUtils.setIpAndFqdnForEelf("NodeConfigManager");
- eelflogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR);
- logger.error("NODE0301 Unable to load local configuration file " + System
- .getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties"), e);
+ eelfLogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR, System.getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties"));
}
provurl = drNodeProperties.getProperty("ProvisioningURL", "https://dmaap-dr-prov:8443/internal/prov");
/*
@@ -149,11 +144,10 @@ public class NodeConfigManager implements DeliveryQueueHelper {
provhost = (new URL(provurl)).getHost();
} catch (Exception e) {
NodeUtils.setIpAndFqdnForEelf("NodeConfigManager");
- eelflogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, provurl);
- logger.error("NODE0302 Bad provisioning server URL " + provurl);
+ eelfLogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, provurl);
System.exit(1);
}
- logger.info("NODE0303 Provisioning server is " + provhost);
+ eelfLogger.info("NODE0303 Provisioning server is " + provhost);
eventlogurl = drNodeProperties.getProperty("LogUploadURL", "https://feeds-drtr.web.att.com/internal/logs");
provcheck = new IsFrom(provhost);
gfport = Integer.parseInt(drNodeProperties.getProperty("IntHttpPort", "8080"));
@@ -192,11 +186,11 @@ public class NodeConfigManager implements DeliveryQueueHelper {
myname = NodeUtils.getCanonicalName(kstype, ksfile, kspass);
if (myname == null) {
NodeUtils.setIpAndFqdnForEelf("NodeConfigManager");
- eelflogger.error(EelfMsgs.MESSAGE_KEYSTORE_FETCH_ERROR, ksfile);
- logger.error("NODE0309 Unable to fetch canonical name from keystore file " + ksfile);
+ eelfLogger.error(EelfMsgs.MESSAGE_KEYSTORE_FETCH_ERROR, ksfile);
+ eelfLogger.error("NODE0309 Unable to fetch canonical name from keystore file " + ksfile);
System.exit(1);
}
- logger.info("NODE0304 My certificate says my name is " + myname);
+ eelfLogger.info("NODE0304 My certificate says my name is " + myname);
pid = new PublishId(myname);
rdmgr = new RedirManager(redirfile, minrsinterval, timer);
pfetcher = new RateLimitedOperation(minpfinterval, timer) {
@@ -204,7 +198,7 @@ public class NodeConfigManager implements DeliveryQueueHelper {
fetchconfig();
}
};
- logger.info("NODE0305 Attempting to fetch configuration at " + provurl);
+ eelfLogger.info("NODE0305 Attempting to fetch configuration at " + provurl);
pfetcher.request();
}
@@ -277,7 +271,7 @@ public class NodeConfigManager implements DeliveryQueueHelper {
private void fetchconfig() {
try {
- logger.info("NodeConfigMan.fetchConfig: provurl:: " + provurl);
+ eelfLogger.info("NodeConfigMan.fetchConfig: provurl:: " + provurl);
Reader r = new InputStreamReader((new URL(provurl)).openStream());
config = new NodeConfig(new ProvData(r), myname, spooldir, port, nak);
localconfig();
@@ -287,13 +281,13 @@ public class NodeConfigManager implements DeliveryQueueHelper {
try {
rr.run();
} catch (Exception e) {
- logger.error("NODE0518 Exception fetchconfig: " + e);
+ eelfLogger.error("NODE0518 Exception fetchconfig: " + e);
}
}
} catch (Exception e) {
NodeUtils.setIpAndFqdnForEelf("fetchconfigs");
- eelflogger.error(EelfMsgs.MESSAGE_CONF_FAILED, e.toString());
- logger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e);
+ eelfLogger.error(EelfMsgs.MESSAGE_CONF_FAILED, e.toString());
+ eelfLogger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e.getMessage());
pfetcher.request();
}
}
@@ -304,11 +298,11 @@ public class NodeConfigManager implements DeliveryQueueHelper {
* seconds), wait a while before fetching again.
*/
public synchronized void gofetch(String remoteAddr) {
- if (provcheck.isReachable(remoteAddr)) {
- logger.info("NODE0307 Received configuration fetch request from provisioning server " + remoteAddr);
+ if (provcheck.isFrom(remoteAddr)) {
+ eelfLogger.info("NODE0307 Received configuration fetch request from provisioning server " + remoteAddr);
pfetcher.request();
} else {
- logger.info("NODE0308 Received configuration fetch request from unexpected server " + remoteAddr);
+ eelfLogger.info("NODE0308 Received configuration fetch request from unexpected server " + remoteAddr);
}
}
@@ -379,7 +373,7 @@ public class NodeConfigManager implements DeliveryQueueHelper {
public String isPublishPermitted(String feedid, String ip) {
return(config.isPublishPermitted(feedid, ip));
}
-
+
/**
* Check who the user is given the feed ID and the offered credentials.
*
@@ -785,15 +779,15 @@ public class NodeConfigManager implements DeliveryQueueHelper {
if (provcheck.isFrom(remoteaddr)) {
String sdir = config.getSpoolDir(subid);
if (sdir != null) {
- logger.info("NODE0310 Received subscription reset request for subscription " + subid
+ eelfLogger.info("NODE0310 Received subscription reset request for subscription " + subid
+ " from provisioning server " + remoteaddr);
} else {
- logger.info("NODE0311 Received subscription reset request for unknown subscription " + subid
+ eelfLogger.info("NODE0311 Received subscription reset request for unknown subscription " + subid
+ " from provisioning server " + remoteaddr);
}
return (sdir);
} else {
- logger.info("NODE0312 Received subscription reset request from unexpected server " + remoteaddr);
+ eelfLogger.info("NODE0312 Received subscription reset request from unexpected server " + remoteaddr);
return (null);
}
}
@@ -848,7 +842,7 @@ public class NodeConfigManager implements DeliveryQueueHelper {
}
return type + "|" + aafInstance + "|" + action;
} catch (Exception e) {
- logger.error("NODE0543 NodeConfigManager.getPermission: ", e);
+ eelfLogger.error("NODE0543 NodeConfigManager.getPermission: ", e.getMessage());
}
return null;
}
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java
index 7ff33ff9..058295d3 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java
@@ -23,7 +23,9 @@
package org.onap.dmaap.datarouter.node;
-import org.apache.log4j.Logger;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.servlet.FilterHolder;
@@ -46,7 +48,7 @@ public class NodeMain {
private NodeMain() {
}
- private static Logger nodeMainLogger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeMain");
+ private static EELFLogger nodeMainLogger = EELFManager.getInstance().getLogger(NodeMain.class);
class Inner {
InputStream getCadiProps() {
@@ -80,7 +82,7 @@ public class NodeMain {
wait();
} catch (Exception exception) {
nodeMainLogger
- .debug("NodeMain: waitForConfig exception. Exception Message:- " + exception.toString(),
+ .error("NodeMain: waitForConfig exception. Exception Message:- " + exception.toString(),
exception);
}
}
@@ -197,7 +199,7 @@ public class NodeMain {
server.start();
nodeMainLogger.info("NODE00006 Node Server started-" + server.getState());
} catch (Exception e) {
- nodeMainLogger.info("NODE00006 Jetty failed to start. Reporting will we unavailable", e);
+ nodeMainLogger.info("NODE00006 Jetty failed to start. Reporting will we unavailable", e.getMessage());
}
server.join();
nodeMainLogger.info("NODE00007 Node Server joined - " + server.getState());
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java
index 41661377..a9842116 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java
@@ -26,7 +26,6 @@ package org.onap.dmaap.datarouter.node;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import org.onap.dmaap.datarouter.node.eelf.EelfMsgs;
import org.slf4j.MDC;
@@ -62,10 +61,9 @@ import static org.onap.dmaap.datarouter.node.NodeUtils.sendResponseError;
*/
public class NodeServlet extends HttpServlet {
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeServlet");
private static NodeConfigManager config;
private static Pattern MetaDataPattern;
- private static EELFLogger eelflogger = EELFManager.getInstance().getLogger(NodeServlet.class);
+ private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(NodeServlet.class);
private final Delivery delivery;
static {
@@ -90,13 +88,13 @@ public class NodeServlet extends HttpServlet {
@Override
public void init() {
config = NodeConfigManager.getInstance();
- logger.info("NODE0101 Node Servlet Configured");
+ eelfLogger.info("NODE0101 Node Servlet Configured");
}
private boolean down(HttpServletResponse resp) throws IOException {
if (config.isShutdown() || !config.isConfigured()) {
- sendResponseError(resp, HttpServletResponse.SC_SERVICE_UNAVAILABLE, logger);
- logger.info("NODE0102 Rejecting request: Service is being quiesced");
+ sendResponseError(resp, HttpServletResponse.SC_SERVICE_UNAVAILABLE, eelfLogger);
+ eelfLogger.info("NODE0102 Rejecting request: Service is being quiesced");
return true;
}
return false;
@@ -109,9 +107,9 @@ public class NodeServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
NodeUtils.setIpAndFqdnForEelf("doGet");
NodeUtils.setRequestIdAndInvocationId(req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"),
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"),
getIdFromPath(req) + "");
try {
if (down(resp)) {
@@ -119,7 +117,7 @@ public class NodeServlet extends HttpServlet {
}
} catch (IOException ioe) {
- logger.error("IOException" + ioe.getMessage());
+ eelfLogger.error("IOException" + ioe.getMessage());
}
String path = req.getPathInfo();
String qs = req.getQueryString();
@@ -140,10 +138,10 @@ public class NodeServlet extends HttpServlet {
}
}
- logger.info("NODE0103 Rejecting invalid GET of " + path + " from " + ip);
- sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, logger);
+ eelfLogger.info("NODE0103 Rejecting invalid GET of " + path + " from " + ip);
+ sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, eelfLogger);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -154,14 +152,14 @@ public class NodeServlet extends HttpServlet {
protected void doPut(HttpServletRequest req, HttpServletResponse resp) {
NodeUtils.setIpAndFqdnForEelf("doPut");
NodeUtils.setRequestIdAndInvocationId(req);
- eelflogger.info(EelfMsgs.ENTRY);
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"),
+ eelfLogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"),
getIdFromPath(req) + "");
try {
common(req, resp, true);
} catch (IOException ioe) {
- logger.error("IOException" + ioe.getMessage());
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.error("IOException" + ioe.getMessage());
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -172,14 +170,14 @@ public class NodeServlet extends HttpServlet {
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) {
NodeUtils.setIpAndFqdnForEelf("doDelete");
NodeUtils.setRequestIdAndInvocationId(req);
- eelflogger.info(EelfMsgs.ENTRY);
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"),
+ eelfLogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader("X-DMAAP-DR-ON-BEHALF-OF"),
getIdFromPath(req) + "");
try {
common(req, resp, false);
} catch (IOException ioe) {
- logger.error("IOException " + ioe.getMessage());
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.error("IOException " + ioe.getMessage());
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -201,21 +199,21 @@ public class NodeServlet extends HttpServlet {
}
String credentials = req.getHeader("Authorization");
if (credentials == null) {
- logger.info("NODE0106 Rejecting unauthenticated PUT or DELETE of " + req.getPathInfo() + " from " + req
+ eelfLogger.error("NODE0106 Rejecting unauthenticated PUT or DELETE of " + req.getPathInfo() + " from " + req
.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Authorization header required");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
if (fileid.startsWith("/publish/")) {
fileid = fileid.substring(9);
int i = fileid.indexOf('/');
if (i == -1 || i == fileid.length() - 1) {
- logger.info("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
+ eelfLogger.error("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_NOT_FOUND,
"Invalid request URI. Expecting <feed-publishing-url>/<fileid>. Possible missing fileid.");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
feedid = fileid.substring(0, i);
@@ -227,13 +225,13 @@ public class NodeServlet extends HttpServlet {
if (!(aafInstance.equalsIgnoreCase("legacy"))) {
isAAFFeed = true;
String permission = config.getPermission(aafInstance);
- logger.info("NodeServlet.common() permission string - " + permission);
+ eelfLogger.info("NodeServlet.common() permission string - " + permission);
//Check in CADI Framework API if user has AAF permission or not
if (!req.isUserInRole(permission)) {
String message = "AAF disallows access to permission string - " + permission;
- logger.info("NODE0106 Rejecting unauthenticated PUT or DELETE of " + req.getPathInfo() + " from " + req.getRemoteAddr());
+ eelfLogger.error("NODE0106 Rejecting unauthenticated PUT or DELETE of " + req.getPathInfo() + " from " + req.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_FORBIDDEN, message);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
}
@@ -246,9 +244,9 @@ public class NodeServlet extends HttpServlet {
targets = config.getTargets(feedid);
} else if (fileid.startsWith("/internal/publish/")) {
if (!config.isAnotherNode(credentials, ip)) {
- logger.info("NODE0107 Rejecting unauthorized node-to-node transfer attempt from " + ip);
+ eelfLogger.error("NODE0107 Rejecting unauthorized node-to-node transfer attempt from " + ip);
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
fileid = fileid.substring(18);
@@ -256,19 +254,19 @@ public class NodeServlet extends HttpServlet {
user = "datartr"; // SP6 : Added usr as datartr to avoid null entries for internal routing
targets = config.parseRouting(req.getHeader("X-DMAAP-DR-ROUTING"));
} else {
- logger.info("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
+ eelfLogger.error("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_NOT_FOUND,
"Invalid request URI. Expecting <feed-publishing-url>/<fileid>.");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
if (fileid.indexOf('/') != -1) {
- logger.info("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
+ eelfLogger.error("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_NOT_FOUND,
"Invalid request URI. Expecting <feed-publishing-url>/<fileid>.");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
String qs = req.getQueryString();
@@ -287,18 +285,18 @@ public class NodeServlet extends HttpServlet {
if (!isAAFFeed) {
String reason = config.isPublishPermitted(feedid, credentials, ip);
if (reason != null) {
- logger.info("NODE0111 Rejecting unauthorized publish attempt to feed " + PathUtil.cleanString(feedid) + " fileid " + PathUtil.cleanString(fileid) + " from " + PathUtil.cleanString(ip) + " reason " + PathUtil.cleanString(reason));
+ eelfLogger.error("NODE0111 Rejecting unauthorized publish attempt to feed " + PathUtil.cleanString(feedid) + " fileid " + PathUtil.cleanString(fileid) + " from " + PathUtil.cleanString(ip) + " reason " + PathUtil.cleanString(reason));
resp.sendError(HttpServletResponse.SC_FORBIDDEN, reason);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
user = config.getAuthUser(feedid, credentials);
} else {
String reason = config.isPublishPermitted(feedid, ip);
if (reason != null) {
- logger.info("NODE0111 Rejecting unauthorized publish attempt to feed " + PathUtil.cleanString(feedid) + " fileid " + PathUtil.cleanString(fileid) + " from " + PathUtil.cleanString(ip) + " reason Invalid AAF user- " + PathUtil.cleanString(reason));
+ eelfLogger.error("NODE0111 Rejecting unauthorized publish attempt to feed " + PathUtil.cleanString(feedid) + " fileid " + PathUtil.cleanString(fileid) + " from " + PathUtil.cleanString(ip) + " reason Invalid AAF user- " + PathUtil.cleanString(reason));
String message = "Invalid AAF user- " + PathUtil.cleanString(reason);
- logger.info("NODE0106 Rejecting unauthenticated PUT or DELETE of " + PathUtil.cleanString(req.getPathInfo()) + " from " + PathUtil.cleanString(req.getRemoteAddr()));
+ eelfLogger.info("NODE0106 Rejecting unauthenticated PUT or DELETE of " + PathUtil.cleanString(req.getPathInfo()) + " from " + PathUtil.cleanString(req.getRemoteAddr()));
resp.sendError(HttpServletResponse.SC_FORBIDDEN, message);
return;
}
@@ -319,9 +317,9 @@ public class NodeServlet extends HttpServlet {
port = ":" + iport;
}
String redirto = "https://" + newnode + port + "/publish/" + feedid + "/" + fileid;
- logger.info("NODE0108 Redirecting publish attempt for feed " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip) + " to " + PathUtil.cleanString(redirto)); //Fortify scan fixes - log forging
+ eelfLogger.info("NODE0108 Redirecting publish attempt for feed " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip) + " to " + PathUtil.cleanString(redirto)); //Fortify scan fixes - log forging
resp.sendRedirect(PathUtil.cleanString(redirto)); //Fortify scan fixes-open redirect - 2 issues
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
resp.setHeader("X-DMAAP-DR-PUBLISH-ID", pubid);
@@ -366,15 +364,15 @@ public class NodeServlet extends HttpServlet {
}
if ("x-dmaap-dr-meta".equals(hnlc)) {
if (hv.length() > 4096) {
- logger.info("NODE0109 Rejecting publish attempt with metadata too long for feed " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip)); //Fortify scan fixes - log forging
+ eelfLogger.error("NODE0109 Rejecting publish attempt with metadata too long for feed " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip)); //Fortify scan fixes - log forging
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Metadata too long");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
if (!MetaDataPattern.matcher(hv.replaceAll("\\\\.", "X")).matches()) {
- logger.info("NODE0109 Rejecting publish attempt with malformed metadata for feed " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip)); //Fortify scan fixes - log forging
+ eelfLogger.error("NODE0109 Rejecting publish attempt with malformed metadata for feed " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip)); //Fortify scan fixes - log forging
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Malformed metadata");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
}
@@ -407,10 +405,10 @@ public class NodeServlet extends HttpServlet {
try {
exlen = Long.parseLong(req.getHeader("Content-Length"));
} catch (Exception e) {
- logger.error("NODE0529 Exception common: " + e);
+ eelfLogger.error("NODE0529 Exception common: " + e);
}
StatusLog.logPubFail(pubid, feedid, logurl, req.getMethod(), ctype, exlen, data.length(), ip, user, ioe.getMessage());
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
throw ioe;
}
Path dpath = Paths.get(fbase);
@@ -439,51 +437,51 @@ public class NodeServlet extends HttpServlet {
try {
exlen = Long.parseLong(req.getHeader("Content-Length"));
} catch (Exception e) {
- logger.debug("NODE00000 Exception common: " + e);
+ eelfLogger.error("NODE00000 Exception common: " + e.getMessage());
}
StatusLog.logPubFail(pubid, feedid, logurl, req.getMethod(), ctype, exlen, data.length(), ip, user, ioe.getMessage());
//Fortify scan fixes - log forging
- logger.info("NODE0110 IO Exception while closing IO stream " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip) + " " + ioe.toString(), ioe);
+ eelfLogger.error("NODE0110 IO Exception while closing IO stream " + PathUtil.cleanString(feedid) + " user " + PathUtil.cleanString(user) + " ip " + PathUtil.cleanString(ip) + " " + ioe.toString(), ioe);
throw ioe;
}
StatusLog.logPub(pubid, feedid, logurl, req.getMethod(), ctype, data.length(), ip, user, HttpServletResponse.SC_NO_CONTENT);
} catch (IOException ioe) {
- logger.info("NODE0110 IO Exception receiving publish attempt for feed " + feedid + " user " + user + " ip " + ip + " " + ioe.toString(), ioe);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.error("NODE0110 IO Exception receiving publish attempt for feed " + feedid + " user " + user + " ip " + ip + " " + ioe.toString(), ioe);
+ eelfLogger.info(EelfMsgs.EXIT);
throw ioe;
} finally {
if (is != null) {
try {
is.close();
} catch (Exception e) {
- logger.error("NODE0530 Exception common: " + e);
+ eelfLogger.error("NODE0530 Exception common: " + e);
}
}
if (dos != null) {
try {
dos.close();
} catch (Exception e) {
- logger.error("NODE0531 Exception common: " + e);
+ eelfLogger.error("NODE0531 Exception common: " + e);
}
}
if (mw != null) {
try {
mw.close();
} catch (Exception e) {
- logger.error("NODE0532 Exception common: " + e);
+ eelfLogger.error("NODE0532 Exception common: " + e);
}
}
try {
data.delete();
} catch (Exception e) {
- logger.error("NODE0533 Exception common: " + e);
+ eelfLogger.error("NODE0533 Exception common: " + e);
}
try {
meta.delete();
} catch (Exception e) {
- logger.error("NODE0534 Exception common: " + e);
+ eelfLogger.error("NODE0534 Exception common: " + e);
}
}
}
@@ -493,11 +491,11 @@ public class NodeServlet extends HttpServlet {
fileid = fileid.substring(8);
int i = fileid.indexOf('/');
if (i == -1 || i == fileid.length() - 1) {
- logger.info("NODE0112 Rejecting bad URI for DELETE of " + req.getPathInfo() + " from " + req
+ eelfLogger.error("NODE0112 Rejecting bad URI for DELETE of " + req.getPathInfo() + " from " + req
.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_NOT_FOUND,
"Invalid request URI. Expecting <subId>/<pubId>.");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return;
}
String subscriptionId = fileid.substring(0, i);
@@ -511,43 +509,43 @@ public class NodeServlet extends HttpServlet {
}
boolean result = delivery.markTaskSuccess(config.getSpoolBase() + "/s/" + subIdDir + "/" + subId, pubid);
if (result) {
- logger.info("NODE0115 Successfully deleted files (" + pubid + ", " + pubid + ".M) from DR Node: "
+ eelfLogger.info("NODE0115 Successfully deleted files (" + pubid + ", " + pubid + ".M) from DR Node: "
+ config.getMyName());
resp.setStatus(HttpServletResponse.SC_OK);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
} else {
- logger.error("NODE0116 " + errorMessage);
+ eelfLogger.error("NODE0116 " + errorMessage);
resp.sendError(HttpServletResponse.SC_NOT_FOUND, "File not found on server.");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
} catch (IOException ioe) {
- logger.error("NODE0117 Unable to delete files (" + pubid + ", " + pubid + ".M) from DR Node: "
+ eelfLogger.error("NODE0117 Unable to delete files (" + pubid + ", " + pubid + ".M) from DR Node: "
+ config.getMyName() + ". Error: " + ioe.getMessage());
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@Nullable
private String getFileId(HttpServletRequest req, HttpServletResponse resp) throws IOException {
if (down(resp)) {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return null;
}
if (!req.isSecure()) {
- logger.info(
+ eelfLogger.error(
"NODE0104 Rejecting insecure PUT or DELETE of " + req.getPathInfo() + " from " + req
.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_FORBIDDEN, "https required on publish requests");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return null;
}
String fileid = req.getPathInfo();
if (fileid == null) {
- logger.info("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
+ eelfLogger.error("NODE0105 Rejecting bad URI for PUT or DELETE of " + req.getPathInfo() + " from " + req
.getRemoteAddr());
resp.sendError(HttpServletResponse.SC_NOT_FOUND,
"Invalid request URI. Expecting <feed-publishing-url>/<fileid>.");
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return null;
}
return fileid;
@@ -557,16 +555,16 @@ public class NodeServlet extends HttpServlet {
try {
boolean deletePermitted = config.isDeletePermitted(subscriptionId);
if (!deletePermitted) {
- logger.error("NODE0113 " + errorMessage + " Error: Subscription "
+ eelfLogger.error("NODE0113 " + errorMessage + " Error: Subscription "
+ subscriptionId + " is not a privileged subscription");
resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return false;
}
} catch (NullPointerException npe) {
- logger.error("NODE0114 " + errorMessage + " Error: Subscription " + subscriptionId + " does not exist");
+ eelfLogger.error("NODE0114 " + errorMessage + " Error: Subscription " + subscriptionId + " does not exist");
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
return false;
}
return true;
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java
index d2ab8034..4601f99c 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeUtils.java
@@ -44,7 +44,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
import org.onap.dmaap.datarouter.node.eelf.EelfMsgs;
import org.slf4j.MDC;
@@ -57,7 +56,6 @@ public class NodeUtils {
private static EELFLogger eelfLogger = EELFManager.getInstance()
.getLogger(NodeUtils.class);
- private static Logger nodeUtilsLogger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeUtils");
private NodeUtils() {
}
@@ -99,7 +97,7 @@ public class NodeUtils {
md.update(key.getBytes());
return (getAuthHdr(node, base64Encode(md.digest())));
} catch (Exception exception) {
- nodeUtilsLogger
+ eelfLogger
.error("Exception in generating Credentials for given node name:= " + exception.toString(),
exception);
return (null);
@@ -122,14 +120,13 @@ public class NodeUtils {
try (FileInputStream fileInputStream = new FileInputStream(ksfile)) {
ks.load(fileInputStream, kspass.toCharArray());
} catch (IOException ioException) {
- nodeUtilsLogger.error("IOException occurred while opening FileInputStream: " + ioException.getMessage(),
+ eelfLogger.error("IOException occurred while opening FileInputStream: " + ioException.getMessage(),
ioException);
return (null);
}
} catch (Exception e) {
setIpAndFqdnForEelf("getCanonicalName");
eelfLogger.error(EelfMsgs.MESSAGE_KEYSTORE_LOAD_ERROR, ksfile, e.toString());
- nodeUtilsLogger.error("NODE0401 Error loading my keystore file + " + ksfile + " " + e.toString(), e);
return (null);
}
return (getCanonicalName(ks));
@@ -164,7 +161,7 @@ public class NodeUtils {
}
}
} catch (Exception e) {
- nodeUtilsLogger.error("NODE0402 Error extracting my name from my keystore file " + e.toString(), e);
+ eelfLogger.error("NODE0402 Error extracting my name from my keystore file " + e.toString(), e.getMessage());
}
return (null);
}
@@ -179,7 +176,7 @@ public class NodeUtils {
try {
return (InetAddress.getByName(ip).getAddress());
} catch (Exception exception) {
- nodeUtilsLogger
+ eelfLogger
.error("Exception in generating byte array for given IP address := " + exception.toString(),
exception);
}
@@ -258,7 +255,7 @@ public class NodeUtils {
MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
} catch (Exception exception) {
- nodeUtilsLogger
+ eelfLogger
.error("Exception in generating byte array for given IP address := " + exception.toString(),
exception);
}
@@ -282,7 +279,7 @@ public class NodeUtils {
MDC.put("InvocationId", invId);
}
- public static void sendResponseError(HttpServletResponse response, int errorCode, Logger intlogger) {
+ public static void sendResponseError(HttpServletResponse response, int errorCode, EELFLogger intlogger) {
try {
response.sendError(errorCode);
} catch (IOException ioe) {
@@ -302,7 +299,7 @@ public class NodeUtils {
return true;
}catch (IOException e){
- nodeUtilsLogger.error("NODE0403 " + file.toString() + " Not in gzip(gz) format: " + e.toString() + e);
+ eelfLogger.error("NODE0403 " + file.toString() + " Not in gzip(gz) format: " + e.toString() + e);
return false;
}
}
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java
index a9c5c6fe..1af7dda4 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/ProvData.java
@@ -29,7 +29,6 @@ import java.util.*;
import org.json.*;
import org.onap.dmaap.datarouter.node.eelf.EelfMsgs;
-import org.apache.log4j.Logger;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -41,8 +40,7 @@ import com.att.eelf.configuration.EELFManager;
* provisioning server to construct arrays of raw configuration entries.
*/
public class ProvData {
- private static EELFLogger eelflogger = EELFManager.getInstance().getLogger(ProvData.class);
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.ProvData");
+ private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(ProvData.class);
private NodeConfig.ProvNode[] pn;
private NodeConfig.ProvParam[] pp;
private NodeConfig.ProvFeed[] pf;
@@ -253,8 +251,8 @@ public class ProvData {
}
} catch (JSONException jse) {
NodeUtils.setIpAndFqdnForEelf("ProvData");
- eelflogger.error(EelfMsgs.MESSAGE_PARSING_ERROR, jse.toString());
- logger.error("NODE0201 Error parsing configuration data from provisioning server " + jse.toString(), jse);
+ eelfLogger.error(EelfMsgs.MESSAGE_PARSING_ERROR, jse.toString());
+ eelfLogger.error("NODE0201 Error parsing configuration data from provisioning server " + jse.toString(), jse);
throw new IOException(jse.toString(), jse);
}
pn = pnv.toArray(new NodeConfig.ProvNode[pnv.size()]);