diff options
author | EmmettCox <emmett.cox@est.tech> | 2019-04-08 10:34:31 +0000 |
---|---|---|
committer | Conor Ward <conor.ward@est.tech> | 2019-04-08 15:49:44 +0000 |
commit | b60213dc26540543f500b3442b061565907c3cf8 (patch) | |
tree | 3d40d1853ed1c545103bbe28cac504d1fa9e704c /datarouter-prov/src/main/java/org/onap | |
parent | 0fa019897cb79de1def349b8fd0b660d1951681a (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-prov/src/main/java/org/onap')
36 files changed, 480 insertions, 412 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java index 525c518e..745e339d 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java @@ -27,7 +27,8 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; -import org.apache.log4j.Logger; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.onap.dmaap.datarouter.authz.AuthorizationResponse; import org.onap.dmaap.datarouter.authz.Authorizer; import org.onap.dmaap.datarouter.authz.impl.AuthzResource.ResourceType; @@ -39,7 +40,7 @@ import org.onap.dmaap.datarouter.authz.impl.AuthzResource.ResourceType; */ public class ProvAuthorizer implements Authorizer { - private Logger log; + private EELFLogger log; private ProvDataProvider provData; private static final String SUBJECT_HEADER = "X-DMAAP-DR-ON-BEHALF-OF"; // HTTP header carrying requester identity @@ -49,7 +50,7 @@ public class ProvAuthorizer implements Authorizer { */ public ProvAuthorizer(ProvDataProvider provData) { this.provData = provData; - this.log = Logger.getLogger(this.getClass()); + this.log = EELFManager.getInstance().getLogger(this.getClass()); } /** diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java index 50ec1b45..deb78b16 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java @@ -24,8 +24,30 @@ package org.onap.dmaap.datarouter.provisioning; +import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN; + +import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS; +import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME; +import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID; + + + +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.cert.X509Certificate; +import java.sql.Connection; +import java.sql.SQLException; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -44,22 +66,10 @@ import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.io.InputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.security.GeneralSecurityException; -import java.security.cert.X509Certificate; -import java.sql.Connection; -import java.sql.SQLException; import java.util.*; import java.util.regex.Pattern; -import static com.att.eelf.configuration.Configuration.*; /** * This is the base class for all Servlets in the provisioning code. It provides standard constants and some common @@ -216,11 +226,11 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { /** * This logger is used to log provisioning events */ - protected static Logger eventlogger; + protected static EELFLogger eventlogger; /** * This logger is used to log internal events (errors, etc.) */ - protected static Logger intlogger; + protected static EELFLogger intlogger; /** * Authorizer - interface to the Policy Engine */ @@ -249,11 +259,11 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { * Initialize data common to all the provisioning server servlets. */ protected BaseServlet() { - if (eventlogger == null) { - eventlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.events"); + if(eventlogger == null) { + this.eventlogger = EELFManager.getInstance().getLogger("EventLog"); } - if (intlogger == null) { - intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); + if(intlogger == null) { + this.intlogger = EELFManager.getInstance().getLogger("InternalLog"); } if (authz == null) { authz = new ProvAuthorizer(this); @@ -370,7 +380,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { return "Unauthorized address: " + remote; } } catch (UnknownHostException e) { - intlogger.error("PROV0051 BaseServlet.isAuthorizedForProvisioning: ", e); + intlogger.error("PROV0051 BaseServlet.isAuthorizedForProvisioning: ", e.getMessage()); return "Unauthorized address: " + remote; } // Does remote have a valid certificate? @@ -419,7 +429,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { return true; } } catch (UnknownHostException e) { - intlogger.error("PROV0052 BaseServlet.isAuthorizedForInternal: ", e); + intlogger.error("PROV0052 BaseServlet.isAuthorizedForInternal: ", e.getMessage()); } return false; } @@ -463,7 +473,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { } } } catch (UnknownHostException e) { - intlogger.error("PROV0053 BaseServlet.addressMatchesNetwork: ", e); + intlogger.error("PROV0053 BaseServlet.addressMatchesNetwork: ", e.getMessage()); return false; } return true; @@ -520,7 +530,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { intlogger.debug("PROV0003 DNS lookup: " + nodes[i] + " => " + na[i].toString()); } catch (UnknownHostException e) { na[i] = null; - intlogger.warn("PROV0004 Cannot lookup " + nodes[i] + ": " + e); + intlogger.warn("PROV0004 Cannot lookup " + nodes[i] + ": " + e.getMessage()); } } @@ -548,7 +558,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { intlogger.debug("PROV0003 DNS lookup: " + pods[i] + " => " + na[i].toString()); } catch (UnknownHostException e) { na[i] = null; - intlogger.warn("PROV0004 Cannot lookup " + pods[i] + ": " + e); + intlogger.warn("PROV0004 Cannot lookup " + pods[i] + ": " + e.getMessage()); } } podAddresses = na; @@ -574,7 +584,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { try (InputStream inStream = getClass().getClassLoader().getResourceAsStream(MAILCONFIG_FILE)) { mailprops.load(inStream); } catch (IOException e) { - intlogger.fatal("PROV9003 Opening properties: " + e.getMessage()); + intlogger.error("PROV9003 Opening properties: " + e.getMessage()); System.exit(1); } } @@ -1081,7 +1091,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { } return type + "|" + aafInstance + "|" + action; } catch (Exception e) { - intlogger.error("PROV7005 BaseServlet.getFeedPermission: ", e); + intlogger.error("PROV7005 BaseServlet.getFeedPermission: ", e.getMessage()); } return null; } @@ -1129,7 +1139,7 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { } return type + "|" + aafInstance + "|" + action; } catch (Exception e) { - intlogger.error("PROV7005 BaseServlet.getSubscriberPermission: ", e); + intlogger.error("PROV7005 BaseServlet.getSubscriberPermission: ", e.getMessage()); } return null; } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java index 9bc91620..86e0268d 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java @@ -52,7 +52,7 @@ import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.send public class DRFeedsServlet extends ProxyServlet { //Adding EELF Logger Rally:US664892 - private static EELFLogger eelflogger = EELFManager.getInstance() + private static EELFLogger eelfLogger = EELFManager.getInstance() .getLogger(DRFeedsServlet.class); /** @@ -61,17 +61,17 @@ public class DRFeedsServlet extends ProxyServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doDelete", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); String message = "DELETE not allowed for the drFeedsURL."; EventLogRecord elr = new EventLogRecord(req); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -82,15 +82,15 @@ public class DRFeedsServlet extends ProxyServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doGet", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -103,7 +103,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -113,7 +113,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Bad URL."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -123,7 +123,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -139,12 +139,12 @@ public class DRFeedsServlet extends ProxyServlet { message = "This feed does not exist in the database."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); } else { // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(FEEDFULL_CONTENT_TYPE); try { @@ -168,7 +168,7 @@ public class DRFeedsServlet extends ProxyServlet { String t = JSONUtilities.createJSONArray(list); // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(FEEDLIST_CONTENT_TYPE); try { @@ -178,7 +178,7 @@ public class DRFeedsServlet extends ProxyServlet { } } } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -188,17 +188,17 @@ public class DRFeedsServlet extends ProxyServlet { @Override public void doPut(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPut", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); String message = "PUT not allowed for the drFeedsURL."; EventLogRecord elr = new EventLogRecord(req); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -209,15 +209,15 @@ public class DRFeedsServlet extends ProxyServlet { @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPost", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -230,7 +230,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -240,7 +240,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Bad URL."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -251,7 +251,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Incorrect content-type"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, eventlogger); return; } @@ -260,7 +260,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Badly formed JSON"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -272,7 +272,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Cannot create feed; the maximum number of feeds has been configured."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_CONFLICT); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_CONFLICT, message, eventlogger); return; } @@ -283,7 +283,7 @@ public class DRFeedsServlet extends ProxyServlet { message = e.getMessage(); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -302,7 +302,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -311,7 +311,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "DRFeedsServlet.doPost() -Invalid request exclude_AAF should not be true if passing AAF_Instance value= " + aafInstance; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -321,7 +321,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "AAF disallows access to permission - " + permission; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -332,7 +332,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -349,7 +349,7 @@ public class DRFeedsServlet extends ProxyServlet { message = "This feed already exists in the database."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -358,7 +358,7 @@ public class DRFeedsServlet extends ProxyServlet { if (doInsert(feed)) { // send response elr.setResult(HttpServletResponse.SC_CREATED); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_CREATED); resp.setContentType(FEEDFULL_CONTENT_TYPE); resp.setHeader("Location", feed.getLinks().getSelf()); @@ -371,11 +371,11 @@ public class DRFeedsServlet extends ProxyServlet { } else { // Something went wrong with the INSERT elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java index 4ab3ef4c..3cbaac3c 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java @@ -54,7 +54,7 @@ import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.send public class FeedServlet extends ProxyServlet { //Adding EELF Logger Rally:US664892 - private static EELFLogger eelflogger = EELFManager.getInstance().getLogger(FeedServlet.class); + private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(FeedServlet.class); /** * Delete the Feed at the address /feed/<feednumber>. @@ -64,15 +64,15 @@ public class FeedServlet extends ProxyServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doDelete", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -85,7 +85,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing "+BEHALF_HEADER+" header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -94,7 +94,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -103,7 +103,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -119,7 +119,7 @@ public class FeedServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -130,7 +130,7 @@ public class FeedServlet extends ProxyServlet { message = "AAF disallows access to permission - " + permission; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -144,17 +144,17 @@ public class FeedServlet extends ProxyServlet { activeFeeds--; // send response elr.setResult(HttpServletResponse.SC_NO_CONTENT); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_NO_CONTENT); provisioningDataChanged(); } else { // Something went wrong with the UPDATE elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } /** @@ -165,15 +165,15 @@ public class FeedServlet extends ProxyServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doGet", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -186,7 +186,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing "+BEHALF_HEADER+" header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -195,7 +195,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -204,7 +204,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -214,14 +214,14 @@ public class FeedServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(FEEDFULL_CONTENT_TYPE); try { @@ -230,7 +230,7 @@ public class FeedServlet extends ProxyServlet { eventlogger.error("IOException" + ioe.getMessage()); } } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } /** @@ -241,15 +241,15 @@ public class FeedServlet extends ProxyServlet { @Override public void doPut(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPut", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -262,7 +262,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing "+BEHALF_HEADER+" header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -271,7 +271,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -280,7 +280,7 @@ public class FeedServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -291,7 +291,7 @@ public class FeedServlet extends ProxyServlet { message = "Incorrect content-type"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, eventlogger); return; } @@ -300,7 +300,7 @@ public class FeedServlet extends ProxyServlet { message = "Badly formed JSON"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -313,7 +313,7 @@ public class FeedServlet extends ProxyServlet { message = e.getMessage(); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -325,7 +325,7 @@ public class FeedServlet extends ProxyServlet { message = "This feed must be modified by the same publisher that created it."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -333,7 +333,7 @@ public class FeedServlet extends ProxyServlet { message = "The name of the feed may not be updated."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -343,7 +343,7 @@ public class FeedServlet extends ProxyServlet { message = "The version of the feed may not be updated."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -362,7 +362,7 @@ public class FeedServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -373,7 +373,7 @@ public class FeedServlet extends ProxyServlet { message = "AAF disallows access to permission - " + permission; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -386,7 +386,7 @@ public class FeedServlet extends ProxyServlet { if (doUpdate(feed)) { // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(FEEDFULL_CONTENT_TYPE); try { @@ -414,11 +414,11 @@ public class FeedServlet extends ProxyServlet { } else { // Something went wrong with the UPDATE elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } /** @@ -427,17 +427,17 @@ public class FeedServlet extends ProxyServlet { @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPost", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); String message = "POST not allowed for the feedURL."; EventLogRecord elr = new EventLogRecord(req); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java index 151c0b26..188dce61 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java @@ -55,7 +55,7 @@ public class GroupServlet extends ProxyServlet { EventLogRecord elr = new EventLogRecord(req); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger); } /** @@ -70,7 +70,7 @@ public class GroupServlet extends ProxyServlet { if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -83,7 +83,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing "+BEHALF_HEADER+" header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -94,7 +94,7 @@ public class GroupServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); resp.sendError(HttpServletResponse.SC_FORBIDDEN, message); return; }*/ @@ -107,7 +107,7 @@ public class GroupServlet extends ProxyServlet { message = "Incorrect content-type"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); resp.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message); return; }*/ @@ -118,7 +118,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing or bad group number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -126,7 +126,7 @@ public class GroupServlet extends ProxyServlet { Group gup = Group.getGroupById(groupid); // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(GROUPFULL_CONTENT_TYPE); try { @@ -141,7 +141,7 @@ public class GroupServlet extends ProxyServlet { // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(GROUPLIST_CONTENT_TYPE); resp.getOutputStream().print(t);*/ @@ -156,7 +156,7 @@ public class GroupServlet extends ProxyServlet { if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -169,7 +169,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing "+BEHALF_HEADER+" header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -178,7 +178,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing or bad groupid."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -187,7 +187,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing or bad group number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -197,7 +197,7 @@ public class GroupServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); resp.sendError(HttpServletResponse.SC_FORBIDDEN, message); return; }*/ @@ -208,7 +208,7 @@ public class GroupServlet extends ProxyServlet { message = "Incorrect content-type"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, eventlogger); return; } @@ -217,7 +217,7 @@ public class GroupServlet extends ProxyServlet { message = "Badly formed JSON"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -230,7 +230,7 @@ public class GroupServlet extends ProxyServlet { message = e.getMessage(); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -247,7 +247,7 @@ public class GroupServlet extends ProxyServlet { if (doUpdate(gup)) { // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(GROUPFULL_CONTENT_TYPE); try { @@ -259,7 +259,7 @@ public class GroupServlet extends ProxyServlet { } else { // Something went wrong with the UPDATE elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } } @@ -275,7 +275,7 @@ public class GroupServlet extends ProxyServlet { if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -288,7 +288,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing "+BEHALF_HEADER+" header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -297,7 +297,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.sendError(HttpServletResponse.SC_BAD_REQUEST, message); return; } @@ -306,7 +306,7 @@ public class GroupServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.sendError(HttpServletResponse.SC_NOT_FOUND, message); return; }*/ @@ -316,7 +316,7 @@ public class GroupServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.sendError(HttpServletResponse.SC_FORBIDDEN, message); return; }*/ @@ -329,7 +329,7 @@ public class GroupServlet extends ProxyServlet { message = "Incorrect content-type"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, eventlogger); return; } @@ -338,7 +338,7 @@ public class GroupServlet extends ProxyServlet { message = "Badly formed JSON"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -352,7 +352,7 @@ public class GroupServlet extends ProxyServlet { message = e.getMessage(); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -373,7 +373,7 @@ public class GroupServlet extends ProxyServlet { if (doInsert(gup)) { // send response elr.setResult(HttpServletResponse.SC_CREATED); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_CREATED); resp.setContentType(GROUPFULL_CONTENT_TYPE); try { @@ -385,7 +385,7 @@ public class GroupServlet extends ProxyServlet { } else { // Something went wrong with the INSERT elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java index 4e727f1d..56b40e04 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java @@ -159,7 +159,7 @@ public class InternalServlet extends ProxyServlet { private static final Object lock = new Object(); private static Integer logseq = 0; // another piece of info to make log spool file names unique //Adding EELF Logger Rally:US664892 - private static EELFLogger eelflogger = EELFManager.getInstance() + private static EELFLogger eelfLogger = EELFManager.getInstance() .getLogger(InternalServlet.class); /** @@ -169,14 +169,14 @@ public class InternalServlet extends ProxyServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doDelete", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); EventLogRecord elr = new EventLogRecord(req); if (!isAuthorizedForInternal(req)) { elr.setMessage("Unauthorized."); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger); return; } @@ -193,14 +193,14 @@ public class InternalServlet extends ProxyServlet { if (param != null) { if (doDelete(param)) { elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); provisioningDataChanged(); provisioningParametersChanged(); } else { // Something went wrong with the DELETE elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } return; @@ -209,7 +209,7 @@ public class InternalServlet extends ProxyServlet { } sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, "Bad URL.", eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -220,9 +220,9 @@ public class InternalServlet extends ProxyServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doGet",req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); String path = req.getPathInfo(); Properties props = (new DB()).getProperties(); if (path.equals("/halt") && !req.isSecure()) { @@ -243,7 +243,7 @@ public class InternalServlet extends ProxyServlet { if (!isAuthorizedForInternal(req)) { elr.setMessage("Unauthorized."); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger); return; } @@ -336,7 +336,7 @@ public class InternalServlet extends ProxyServlet { } sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, "Bad URL.", eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -347,14 +347,14 @@ public class InternalServlet extends ProxyServlet { @Override public void doPut(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPut", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); EventLogRecord elr = new EventLogRecord(req); if (!isAuthorizedForInternal(req)) { elr.setMessage("Unauthorized."); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger); return; } @@ -372,14 +372,14 @@ public class InternalServlet extends ProxyServlet { param.setValue(t); if (doUpdate(param)) { elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); provisioningDataChanged(); provisioningParametersChanged(); } else { // Something went wrong with the UPDATE elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } return; @@ -388,7 +388,7 @@ public class InternalServlet extends ProxyServlet { } sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, "Bad URL.", eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -400,14 +400,14 @@ public class InternalServlet extends ProxyServlet { @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPost", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); EventLogRecord elr = new EventLogRecord(req); if (!isAuthorizedForInternal(req)) { elr.setMessage("Unauthorized."); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger); return; } @@ -426,14 +426,14 @@ public class InternalServlet extends ProxyServlet { param = new Parameters(key, t); if (doInsert(param)) { elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); provisioningDataChanged(); provisioningParametersChanged(); } else { // Something went wrong with the INSERT elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } return; @@ -447,7 +447,7 @@ public class InternalServlet extends ProxyServlet { elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); elr.setMessage("Bad media type: " + ctype); resp.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); return; } String spooldir = (new DB()).getProperties().getProperty("org.onap.dmaap.datarouter.provserver.spooldir"); @@ -464,7 +464,7 @@ public class InternalServlet extends ProxyServlet { } else { elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); resp.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); return; } } @@ -487,7 +487,7 @@ public class InternalServlet extends ProxyServlet { if (((avail * 100) / total) < 5) { elr.setResult(HttpServletResponse.SC_SERVICE_UNAVAILABLE); resp.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); return; } Path tmppath = Paths.get(spooldir, spoolname); @@ -497,7 +497,7 @@ public class InternalServlet extends ProxyServlet { Files.move(tmppath, donepath, StandardCopyOption.REPLACE_EXISTING); elr.setResult(HttpServletResponse.SC_CREATED); resp.setStatus(HttpServletResponse.SC_CREATED); - eventlogger.info(elr); + eventlogger.info(elr.toString()); LogfileLoader.getLoader(); // This starts the logfile loader "task" } catch (IOException ioe) { intlogger.error("IOException" + ioe.getMessage()); @@ -512,7 +512,7 @@ public class InternalServlet extends ProxyServlet { elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); elr.setMessage("Bad media type: " + ctype); resp.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); return; } try { @@ -527,7 +527,7 @@ public class InternalServlet extends ProxyServlet { resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType("text/plain"); LogRecord.printLogRecords(resp.getOutputStream(), bs); - eventlogger.info(elr); + eventlogger.info(elr.toString()); } catch (IOException ioe) { intlogger.error("IOException" + ioe.getMessage()); } @@ -536,9 +536,9 @@ public class InternalServlet extends ProxyServlet { elr.setResult(HttpServletResponse.SC_NOT_FOUND); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, "Bad URL.", eventlogger); - eventlogger.info(elr); + eventlogger.error(elr.toString()); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java index c58bda8e..77bcbddc 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/LogServlet.java @@ -64,7 +64,7 @@ import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.send @SuppressWarnings("serial")
public class LogServlet extends BaseServlet {
//Adding EELF Logger Rally:US664892
- private static EELFLogger eelflogger = EELFManager.getInstance().getLogger(LogServlet.class);
+ private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(LogServlet.class);
private static final long TWENTYFOUR_HOURS = (24 * 60 * 60 * 1000L);
private static final String FMT_1 = "yyyy-MM-dd'T'HH:mm:ss'Z'";
private static final String FMT_2 = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
@@ -148,17 +148,17 @@ public class LogServlet extends BaseServlet { @Override
public void doDelete(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doDelete", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
String message = "DELETE not allowed for the logURL.";
EventLogRecord elr = new EventLogRecord(req);
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
/**
@@ -168,9 +168,9 @@ public class LogServlet extends BaseServlet { @Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doGet", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
int id = getIdFromPath(req);
if (id < 0) {
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, "Missing or bad feed/subscription number.", eventlogger);
@@ -229,7 +229,7 @@ public class LogServlet extends BaseServlet { eventlogger.error("IOException: " + ioe.getMessage());
}
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
/**
@@ -238,17 +238,17 @@ public class LogServlet extends BaseServlet { @Override
public void doPut(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doPut", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER),getIdFromPath(req)+"");
String message = "PUT not allowed for the logURL.";
EventLogRecord elr = new EventLogRecord(req);
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
/**
@@ -257,17 +257,17 @@ public class LogServlet extends BaseServlet { @Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doPost", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER));
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER));
String message = "POST not allowed for the logURL.";
EventLogRecord elr = new EventLogRecord(req);
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java index 1bd3cbfa..a0d8664f 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java @@ -24,7 +24,9 @@ package org.onap.dmaap.datarouter.provisioning; -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.server.handler.ContextHandlerCollection; @@ -87,7 +89,7 @@ public class Main { static final String KEYSTORE_PASS_PROPERTY = "org.onap.dmaap.datarouter.provserver.keystore.password"; static final String TRUSTSTORE_PATH_PROPERTY = "org.onap.dmaap.datarouter.provserver.truststore.path"; static final String TRUSTSTORE_PASS_PROPERTY = "org.onap.dmaap.datarouter.provserver.truststore.password"; - public static final Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); + public static final EELFLogger intlogger = EELFManager.getInstance().getLogger("org.onap.dmaap.datarouter.provisioning.internal"); /** * The one and only {@link Server} instance in this JVM @@ -100,7 +102,7 @@ public class Main { try { in = getClass().getClassLoader().getResourceAsStream("drProvCadi.properties"); } catch (Exception e) { - intlogger.error("Exception in Main.getCadiProps() method ", e); + intlogger.error("Exception in Main.getCadiProps() method ", e.getMessage()); } return in; } @@ -113,9 +115,8 @@ public class Main { * @throws Exception if Jetty has a problem starting */ public static void main(String[] args) throws Exception { - // Get prov properties + Security.setProperty("networkaddress.cache.ttl", "4"); Properties provProperties = (new DB()).getProperties(); - // Check DB is accessible and contains the expected tables if (!checkDatabase()) { System.exit(1); @@ -247,7 +248,7 @@ public class Main { InputStream in = obj.getCadiProps(); cadiProperties.load(in); } catch (IOException e1) { - intlogger.error("PROV0001 Exception loading CADI properties", e1); + intlogger.error("PROV0001 Exception loading CADI properties", e1.getMessage()); } cadiProperties.setProperty("aaf_locate_url", provProperties.getProperty("org.onap.dmaap.datarouter.provserver.cadi.aaf.url", "https://aaf-onap-test.osaaf.org:8095")); intlogger.info("PROV0001 aaf_url set to - " + cadiProperties.getProperty("aaf_url")); @@ -280,7 +281,7 @@ public class Main { server.start(); intlogger.info("Prov Server started-" + server.getState()); } catch (Exception e) { - intlogger.info("Jetty failed to start. Reporting will we unavailable", e); + intlogger.info("Jetty failed to start. Reporting will we unavailable", e.getMessage()); } server.join(); intlogger.info("PROV0001 **** AT&T Data Router Provisioning Server halted."); @@ -301,7 +302,7 @@ public class Main { Thread.sleep(5000L); System.exit(0); } catch (Exception e) { - intlogger.error("Exception in Main.shutdown() method " + e); + intlogger.error("Exception in Main.shutdown() method " + e.getMessage()); } }); } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java index 193485e6..b9d5e7a6 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Poker.java @@ -36,7 +36,9 @@ import java.util.Set; import java.util.Timer;
import java.util.TimerTask;
import java.util.TreeSet;
-import org.apache.log4j.Logger;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
@@ -72,13 +74,13 @@ public class Poker extends TimerTask { private long timer1;
private long timer2;
private String thisPod; // DNS name of this machine
- private Logger logger;
+ private EELFLogger logger;
private String provString;
private Poker() {
timer1 = timer2 = 0;
Timer rolex = new Timer();
- logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ logger = EELFManager.getInstance().getLogger("InternalLog");;
try {
thisPod = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java index ca63f466..67a74de3 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java @@ -250,7 +250,7 @@ public class ProxyServlet extends BaseServlet { copyResponseHeaders(pxyResponse, resp); copyEntityContent(pxyResponse, resp); } catch (IOException e) { - intlogger.warn("ProxyServlet: " + e); + intlogger.warn("ProxyServlet: " + e.getMessage()); sendResponseError(resp, HttpServletResponse.SC_SERVICE_UNAVAILABLE, "", intlogger); } finally { proxy.releaseConnection(); diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java index 42d2b113..af2085bc 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java @@ -59,7 +59,7 @@ public class PublishServlet extends BaseServlet { private String provstring;
private List<IngressRoute> irt;
//Adding EELF Logger Rally:US664892
- private static EELFLogger eelflogger = EELFManager.getInstance()
+ private static EELFLogger eelfLogger = EELFManager.getInstance()
.getLogger(PublishServlet.class);
private static final Object lock = new Object();
@@ -76,48 +76,48 @@ public class PublishServlet extends BaseServlet { @Override
public void doDelete(HttpServletRequest req, HttpServletResponse resp) {
setUpEelfForPublishServlet(req, "doDelete");
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
redirect(req, resp);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
setUpEelfForPublishServlet(req, "doGet");
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
redirect(req, resp);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@Override
public void doPut(HttpServletRequest req, HttpServletResponse resp) {
setUpEelfForPublishServlet(req, "doPut");
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
redirect(req, resp);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) {
setUpEelfForPublishServlet(req, "doPost");
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER));
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER));
redirect(req, resp);
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -145,7 +145,7 @@ public class PublishServlet extends BaseServlet { : "Invalid request - Missing file ID.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_NOT_FOUND);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
resp.sendError(HttpServletResponse.SC_NOT_FOUND, message);
} else {
@@ -162,7 +162,7 @@ public class PublishServlet extends BaseServlet { String message = "Redirected to: " + newurl;
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_MOVED_PERMANENTLY);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
resp.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
resp.setHeader("Location", newurl);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java index 12699a49..4dd422a0 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/RouteServlet.java @@ -138,7 +138,7 @@ public class RouteServlet extends ProxyServlet { if (!isAuthorizedForInternal(req)) {
elr.setMessage("Unauthorized.");
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger);
return;
}
@@ -226,14 +226,14 @@ public class RouteServlet extends ProxyServlet { }
if (rv) {
elr.setResult(HttpServletResponse.SC_OK);
- eventlogger.info(elr);
+ eventlogger.info(elr.toString());
resp.setStatus(HttpServletResponse.SC_OK);
provisioningDataChanged();
provisioningParametersChanged();
} else {
// Something went wrong with the DELETE
elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger);
}
}
@@ -246,7 +246,7 @@ public class RouteServlet extends ProxyServlet { if (!isAuthorizedForInternal(req)) {
elr.setMessage("Unauthorized.");
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger);
return;
}
@@ -327,7 +327,7 @@ public class RouteServlet extends ProxyServlet { if (!isAuthorizedForInternal(req)) {
elr.setMessage("Unauthorized.");
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger);
return;
}
@@ -342,7 +342,7 @@ public class RouteServlet extends ProxyServlet { if (!isAuthorizedForInternal(req)) {
elr.setMessage("Unauthorized.");
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, "Unauthorized.", eventlogger);
return;
}
@@ -368,7 +368,7 @@ public class RouteServlet extends ProxyServlet { int seq = (t != null) ? Integer.parseInt(t) : (IngressRoute.getMaxSequence() + 100);
ins = new Insertable[] { new IngressRoute(seq, feedid, user, subnet, NodeClass.lookupNodeNames(nodepatt)) };
} catch (Exception e) {
- intlogger.info(e);
+ intlogger.info(e.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid arguments in 'add ingress' command.", intlogger);
return;
}
@@ -384,7 +384,7 @@ public class RouteServlet extends ProxyServlet { String node = NodeClass.normalizeNodename(req.getParameter("node"));
ins = new Insertable[] { new EgressRoute(subid, node) };
} catch (Exception e) {
- intlogger.info(e);
+ intlogger.info(e.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid arguments in 'add egress' command.", intlogger);
return;
}
@@ -410,7 +410,7 @@ public class RouteServlet extends ProxyServlet { }
ins = new Insertable[] { nr };
} catch (IllegalArgumentException e) {
- intlogger.info(e);
+ intlogger.info(e.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid arguments in 'add network' command.", intlogger);
return;
}
@@ -425,14 +425,14 @@ public class RouteServlet extends ProxyServlet { }
if (rv) {
elr.setResult(HttpServletResponse.SC_OK);
- eventlogger.info(elr);
+ eventlogger.info(elr.toString());
resp.setStatus(HttpServletResponse.SC_OK);
provisioningDataChanged();
provisioningParametersChanged();
} else {
// Something went wrong with the INSERT
elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, intlogger);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java index b77062fa..34ba5d34 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/StatisticsServlet.java @@ -70,7 +70,7 @@ public class StatisticsServlet extends BaseServlet { EventLogRecord elr = new EventLogRecord(req);
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger);
}
@@ -407,7 +407,7 @@ public class StatisticsServlet extends BaseServlet { EventLogRecord elr = new EventLogRecord(req);
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger);
}
@@ -420,7 +420,7 @@ public class StatisticsServlet extends BaseServlet { EventLogRecord elr = new EventLogRecord(req);
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger);
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java index 35ce062d..69451a3b 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java @@ -55,7 +55,7 @@ import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.send public class SubscribeServlet extends ProxyServlet { //Adding EELF Logger Rally:US664892 - private static EELFLogger eelflogger = EELFManager.getInstance() + private static EELFLogger eelfLogger = EELFManager.getInstance() .getLogger(SubscribeServlet.class); /** @@ -64,17 +64,17 @@ public class SubscribeServlet extends ProxyServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doDelete", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); String message = "DELETE not allowed for the subscribeURL."; EventLogRecord elr = new EventLogRecord(req); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -85,15 +85,15 @@ public class SubscribeServlet extends ProxyServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doGet", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -106,7 +106,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -115,7 +115,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -124,7 +124,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -134,7 +134,7 @@ public class SubscribeServlet extends ProxyServlet { // send response elr.setResult(HttpServletResponse.SC_OK); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(SUBLIST_CONTENT_TYPE); try { @@ -143,7 +143,7 @@ public class SubscribeServlet extends ProxyServlet { eventlogger.error("IOException: " + ioe.getMessage()); } } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -153,17 +153,17 @@ public class SubscribeServlet extends ProxyServlet { @Override public void doPut(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPut", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); String message = "PUT not allowed for the subscribeURL."; EventLogRecord elr = new EventLogRecord(req); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED, message, eventlogger); } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } @@ -174,15 +174,15 @@ public class SubscribeServlet extends ProxyServlet { @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) { setIpFqdnRequestIDandInvocationIDForEelf("doPost", req); - eelflogger.info(EelfMsgs.ENTRY); + eelfLogger.info(EelfMsgs.ENTRY); try { - eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -195,7 +195,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -204,7 +204,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -213,7 +213,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Missing or bad feed number."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger); return; } @@ -225,7 +225,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Incorrect content-type"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, eventlogger); return; } @@ -234,7 +234,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Badly formed JSON"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -246,7 +246,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Cannot create subscription; the maximum number of subscriptions has been configured."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_CONFLICT); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_CONFLICT, message, eventlogger); return; } @@ -258,7 +258,7 @@ public class SubscribeServlet extends ProxyServlet { message = e.getMessage(); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } @@ -281,7 +281,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Policy Engine disallows access"; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -290,7 +290,7 @@ public class SubscribeServlet extends ProxyServlet { message = "AAF Subscriber can not be added to legacy Feed- " + feedid; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -302,7 +302,7 @@ public class SubscribeServlet extends ProxyServlet { message = "Policy Engine disallows access."; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -314,7 +314,7 @@ public class SubscribeServlet extends ProxyServlet { message = "AAF disallows access to permission - " + permission; elr.setMessage(message); elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger); return; } @@ -334,7 +334,7 @@ public class SubscribeServlet extends ProxyServlet { if (doInsert(sub)) { // send response elr.setResult(HttpServletResponse.SC_CREATED); - eventlogger.info(elr); + eventlogger.info(elr.toString()); resp.setStatus(HttpServletResponse.SC_CREATED); resp.setContentType(SUBFULL_CONTENT_TYPE); resp.setHeader("Location", sub.getLinks().getSelf()); @@ -349,11 +349,11 @@ public class SubscribeServlet extends ProxyServlet { // Something went wrong with the INSERT activeSubs--; elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - eventlogger.info(elr); + eventlogger.error(elr.toString()); sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, eventlogger); } } finally { - eelflogger.info(EelfMsgs.EXIT); + eelfLogger.info(EelfMsgs.EXIT); } } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java index d7c46570..63ff84de 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java @@ -60,7 +60,7 @@ public class SubscriptionServlet extends ProxyServlet { private static final String SUBCNTRL_CONTENT_TYPE = "application/vnd.dmaap-dr.subscription-control";
//Adding EELF Logger Rally:US664892
- private static EELFLogger eelflogger = EELFManager.getInstance()
+ private static EELFLogger eelfLogger = EELFManager.getInstance()
.getLogger(SubscriptionServlet.class);
/**
@@ -70,15 +70,15 @@ public class SubscriptionServlet extends ProxyServlet { @Override
public void doDelete(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doDelete", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
EventLogRecord elr = new EventLogRecord(req);
String message = isAuthorizedForProvisioning(req);
if (message != null) {
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -91,7 +91,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -100,7 +100,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing or bad subscription number.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -109,7 +109,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing or bad subscription number.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_NOT_FOUND);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger);
return;
}
@@ -125,7 +125,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Policy Engine disallows access.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -136,7 +136,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "AAF disallows access to permission - " + permission;
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -149,17 +149,17 @@ public class SubscriptionServlet extends ProxyServlet { activeSubs--;
// send response
elr.setResult(HttpServletResponse.SC_NO_CONTENT);
- eventlogger.info(elr);
+ eventlogger.info(elr.toString());
resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
provisioningDataChanged();
} else {
// Something went wrong with the DELETE
elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, intlogger);
}
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -171,15 +171,15 @@ public class SubscriptionServlet extends ProxyServlet { @Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doGet", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
EventLogRecord elr = new EventLogRecord(req);
String message = isAuthorizedForProvisioning(req);
if (message != null) {
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -192,7 +192,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -201,7 +201,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing or bad subscription number.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -210,7 +210,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing or bad subscription number.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_NOT_FOUND);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger);
return;
}
@@ -220,14 +220,14 @@ public class SubscriptionServlet extends ProxyServlet { message = "Policy Engine disallows access.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
// send response
elr.setResult(HttpServletResponse.SC_OK);
- eventlogger.info(elr);
+ eventlogger.info(elr.toString());
resp.setStatus(HttpServletResponse.SC_OK);
resp.setContentType(SUBFULL_CONTENT_TYPE);
try {
@@ -236,7 +236,7 @@ public class SubscriptionServlet extends ProxyServlet { eventlogger.error("IOException: " + ioe.getMessage());
}
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -247,15 +247,15 @@ public class SubscriptionServlet extends ProxyServlet { @Override
public void doPut(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doPut", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + "");
EventLogRecord elr = new EventLogRecord(req);
String message = isAuthorizedForProvisioning(req);
if (message != null) {
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -268,7 +268,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -277,7 +277,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing or bad subscription number.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -286,7 +286,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing or bad subscription number.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_NOT_FOUND);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger);
return;
}
@@ -297,7 +297,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Incorrect content-type";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, eventlogger);
return;
}
@@ -306,7 +306,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Badly formed JSON";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -320,7 +320,7 @@ public class SubscriptionServlet extends ProxyServlet { message = e.getMessage();
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -337,7 +337,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Policy Engine disallows access.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -348,7 +348,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "AAF disallows access to permission - " + permission;
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -365,7 +365,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "This subscriber must be modified by the same subscriber that created it.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -374,7 +374,7 @@ public class SubscriptionServlet extends ProxyServlet { if (doUpdate(sub)) {
// send response
elr.setResult(HttpServletResponse.SC_OK);
- eventlogger.info(elr);
+ eventlogger.info(elr.toString());
resp.setStatus(HttpServletResponse.SC_OK);
resp.setContentType(SUBFULL_CONTENT_TYPE);
try {
@@ -401,11 +401,11 @@ public class SubscriptionServlet extends ProxyServlet { } else {
// Something went wrong with the UPDATE
elr.setResult(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, DB_PROBLEM_MSG, intlogger);
}
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -417,15 +417,15 @@ public class SubscriptionServlet extends ProxyServlet { public void doPost(HttpServletRequest req, HttpServletResponse resp) {
setIpFqdnRequestIDandInvocationIDForEelf("doPost", req);
- eelflogger.info(EelfMsgs.ENTRY);
+ eelfLogger.info(EelfMsgs.ENTRY);
try {
- eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER));
+ eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER));
EventLogRecord elr = new EventLogRecord(req);
String message = isAuthorizedForProvisioning(req);
if (message != null) {
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -438,7 +438,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing " + BEHALF_HEADER + " header.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -447,7 +447,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Missing or bad subscription number.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -458,7 +458,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Incorrect content-type";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, eventlogger);
return;
}
@@ -468,7 +468,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Policy Engine disallows access.";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_FORBIDDEN);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
return;
}
@@ -477,7 +477,7 @@ public class SubscriptionServlet extends ProxyServlet { message = "Badly formed JSON";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
return;
}
@@ -493,17 +493,17 @@ public class SubscriptionServlet extends ProxyServlet { }
// send response
elr.setResult(HttpServletResponse.SC_ACCEPTED);
- eventlogger.info(elr);
+ eventlogger.info(elr.toString());
resp.setStatus(HttpServletResponse.SC_ACCEPTED);
} catch (JSONException e) {
message = "Badly formed JSON";
elr.setMessage(message);
elr.setResult(HttpServletResponse.SC_BAD_REQUEST);
- eventlogger.info(elr);
+ eventlogger.error(elr.toString());
sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);
}
} finally {
- eelflogger.info(EelfMsgs.EXIT);
+ eelfLogger.info(EelfMsgs.EXIT);
}
}
@@ -542,7 +542,7 @@ public class SubscriptionServlet extends ProxyServlet { }
}
} catch (Exception e) {
- intlogger.warn("Caught exception in SubscriberNotifyThread: " + e);
+ intlogger.warn("Caught exception in SubscriberNotifyThread: " + e.getMessage());
}
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java index 9eece14f..3097a9db 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java @@ -50,6 +50,8 @@ import java.util.TreeSet; import javax.servlet.http.HttpServletResponse; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; @@ -60,7 +62,6 @@ import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ContentType; import org.apache.http.impl.client.AbstractHttpClient; import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -117,7 +118,7 @@ public class SynchronizerTask extends TimerTask { private static final String[] stnames = {"UNKNOWN", "ACTIVE", "STANDBY"}; private static final long ONE_HOUR = 60 * 60 * 1000L; - private final Logger logger; + private final EELFLogger logger; private final Timer rolex; private final String spooldir; private int state; @@ -139,7 +140,7 @@ public class SynchronizerTask extends TimerTask { @SuppressWarnings("deprecation") private SynchronizerTask() { - logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); + logger = EELFManager.getInstance().getLogger("InternalLog"); rolex = new Timer(); spooldir = (new DB()).getProperties().getProperty("org.onap.dmaap.datarouter.provserver.spooldir"); state = UNKNOWN; diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java index 832b8edc..12135969 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java @@ -33,7 +33,8 @@ import java.util.Objects; import java.util.SortedSet;
import java.util.TreeSet;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
@@ -45,7 +46,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; */
public class EgressRoute extends NodeClass implements Comparable<EgressRoute> {
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private final int subid;
private final int nodeid;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java index 4d0b6acc..ce03f59a 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EventLogRecord.java @@ -35,7 +35,7 @@ import org.onap.dmaap.datarouter.provisioning.BaseServlet; * (who made the provisioning request including the IP address, the X-DMAAP-DR-ON-BEHALF-OF
* header value, and the client certificate), a what (what request was made; the method
* and servlet involved), and a how (how the request was handled; the result code and
- * message returned to the client). EventLogRecords are logged using log4j at the INFO level.
+ * message returned to the client).
*
* @author Robert Eby
* @version $Id: EventLogRecord.java,v 1.1 2013/04/26 21:00:25 eby Exp $
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java index 502dbbd1..506821e2 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java @@ -24,18 +24,16 @@ package org.onap.dmaap.datarouter.provisioning.beans;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
import org.onap.dmaap.datarouter.provisioning.utils.JSONUtilities;
-import org.onap.dmaap.datarouter.provisioning.utils.PasswordProcessor;
import org.onap.dmaap.datarouter.provisioning.utils.URLUtilities;
import java.io.InvalidObjectException;
-import java.security.GeneralSecurityException;
import java.sql.*;
import java.util.Date;
import java.util.*;
@@ -47,7 +45,7 @@ import java.util.*; * @version $Id: Feed.java,v 1.13 2013/10/28 18:06:52 eby Exp $
*/
public class Feed extends Syncable {
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private static int next_feedid = getMaxFeedID() + 1;
private int feedid;
@@ -87,7 +85,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.log(Level.WARN, "PROV0024 Feed.isFeedValid: ", e);
+ intlogger.warn("PROV0024 Feed.isFeedValid: ", e.getMessage());
}
return count != 0;
}
@@ -137,8 +135,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.info("PROV0025 Feed.countActiveFeeds: " + e.getMessage());
- intlogger.log(Level.WARN, "PROV0025 Feed.countActiveFeeds: ", e);
+ intlogger.warn("PROV0025 Feed.countActiveFeeds: ", e.getMessage());
}
return count;
}
@@ -158,8 +155,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.info("PROV0026 Feed.getMaxFeedID: "+e.getMessage());
- intlogger.log(Level.WARN, "PROV0026 Feed.getMaxFeedID: ", e);
+ intlogger.warn("PROV0026 Feed.getMaxFeedID: ", e.getMessage());
}
return max;
}
@@ -205,7 +201,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.log(Level.WARN, "PROV0027 Feed.getAllFeeds: ", e);
+ intlogger.warn("PROV0027 Feed.getAllFeeds: ", e.getMessage());
}
return map.values();
}
@@ -239,7 +235,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.log(Level.WARN, "PROV0028 Feed.getFilteredFeedUrlList: ", e);
+ intlogger.warn("PROV0028 Feed.getFilteredFeedUrlList: ", e.getMessage());
}
return list;
}
@@ -276,7 +272,7 @@ public class Feed extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.log(Level.WARN, "PROV0029 Feed.getFeedBySQL: ", e);
+ intlogger.warn("PROV0029 Feed.getFeedBySQL: ", e.getMessage());
}
return feed;
}
@@ -383,7 +379,7 @@ public class Feed extends Syncable { JSONObject jol = jo.optJSONObject("links");
this.links = (jol == null) ? (new FeedLinks()) : (new FeedLinks(jol));
} catch (InvalidObjectException e) {
- intlogger.log(Level.WARN, "PROV0030 Feed.Feed: ", e);
+ intlogger.warn("PROV0030 Feed.Feed: ", e.getMessage());
throw e;
} catch (Exception e) {
intlogger.error("PROV0031 Feed.Feed: invalid JSON: "+e);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java index 30fc87c4..8904765a 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java @@ -31,10 +31,10 @@ import java.sql.SQLException; import java.sql.Statement;
import java.util.*;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
-import org.onap.dmaap.datarouter.provisioning.utils.URLUtilities;
/**
* The representation of a Subscription. Subscriptions can be retrieved from the DB, or stored/updated in the DB.
@@ -44,7 +44,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.URLUtilities; */
public class Group extends Syncable {
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private static int next_groupid = getMaxGroupID() + 1;
private int groupid;
@@ -237,7 +237,7 @@ public class Group extends Syncable { return groupid;
}
- public static Logger getIntlogger() {
+ public static EELFLogger getIntlogger() {
return intlogger;
}
@@ -245,7 +245,7 @@ public class Group extends Syncable { this.groupid = groupid;
}
- public static void setIntlogger(Logger intlogger) {
+ public static void setIntlogger(EELFLogger intlogger) {
Group.intlogger = intlogger;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java index 033b3900..bbed37a3 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java @@ -39,8 +39,9 @@ import java.util.TreeSet; import javax.servlet.http.HttpServletRequest;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
@@ -53,7 +54,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; */
public class IngressRoute extends NodeClass implements Comparable<IngressRoute> {
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private final int seq;
private final int feedid;
private final String userid;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java index b7b82729..86d1faea 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java @@ -33,7 +33,9 @@ import java.sql.SQLException; import java.sql.Types;
import java.text.ParseException;
import java.util.Iterator;
-import org.apache.log4j.Logger;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
import org.onap.dmaap.datarouter.provisioning.utils.RLEBitSet;
@@ -53,7 +55,7 @@ public class LogRecord extends BaseLogRecord { * @param bs the {@link RLEBitSet} listing the record IDs to print
* @throws IOException
*/
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.beans");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
public static void printLogRecords(OutputStream os, RLEBitSet bs) throws IOException {
final String sql = "select * from LOG_RECORDS where RECORD_ID >= ? AND RECORD_ID <= ?";
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java index 8264de28..94eeec4a 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java @@ -33,7 +33,8 @@ import java.util.Objects; import java.util.SortedSet;
import java.util.TreeSet;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
@@ -45,7 +46,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; */
public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> {
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private final int fromnode;
private final int tonode;
private final int vianode;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java index 9d43bd0a..f3ef5d6a 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java @@ -32,7 +32,9 @@ import java.util.HashMap; import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
-import org.apache.log4j.Logger;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
/**
@@ -44,7 +46,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; public abstract class NodeClass extends Syncable {
private static Map<String, Integer> map;
- private static Logger intLogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intLogger = EELFManager.getInstance().getLogger("InternalLog");
public NodeClass() {
// init on first use
if (map == null) {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java index 4d2c9d1f..08914868 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java @@ -30,7 +30,8 @@ import java.sql.SQLException; import java.sql.Statement;
import java.util.*;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
@@ -67,7 +68,7 @@ public class Parameters extends Syncable { public static final String THROTTLE_FILTER = "THROTTLE_FILTER";
public static final String STATIC_ROUTING_NODES = "STATIC_ROUTING_NODES"; //Adding new param for static Routing - Rally:US664862-1610
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private String keyname;
private String value;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java index bdc062f9..442a7642 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java @@ -23,18 +23,24 @@ package org.onap.dmaap.datarouter.provisioning.beans;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import java.io.InvalidObjectException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONObject;
import org.onap.dmaap.datarouter.provisioning.utils.DB;
-import org.onap.dmaap.datarouter.provisioning.utils.PasswordProcessor;
import org.onap.dmaap.datarouter.provisioning.utils.URLUtilities;
-import java.io.InvalidObjectException;
-import java.security.GeneralSecurityException;
-import java.sql.*;
-import java.util.Date;
-import java.util.*;
/**
* The representation of a Subscription. Subscriptions can be retrieved from the DB, or stored/updated in the DB.
@@ -51,7 +57,7 @@ public class Subscription extends Syncable { private static final String GROUPID_KEY = "groupid";
private static final String LAST_MOD_KEY = "last_mod";
private static final String CREATED_DATE = "created_date";
- private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private static int nextSubid = getMaxSubID() + 1;
private int subid;
@@ -111,7 +117,7 @@ public class Subscription extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- intlogger.error(e);
+ intlogger.error(e.toString());
}
return list;
}
@@ -469,7 +475,6 @@ public class Subscription extends Syncable { } catch (SQLException e) {
rv = false;
intlogger.warn("PROV0005 doInsert: " + e.getMessage());
- intlogger.log(Level.WARN, "PROV0005 Subscription.doInsert(1): ", e);
} finally {
try {
if (ps != null) {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/eelf/DebugTraceFilter.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/eelf/DebugTraceFilter.java new file mode 100644 index 00000000..6bc555e8 --- /dev/null +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/eelf/DebugTraceFilter.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.dmaap.datarouter.provisioning.eelf; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.filter.Filter; +import ch.qos.logback.core.spi.FilterReply; + +public class DebugTraceFilter extends Filter<ILoggingEvent> { + @Override + public FilterReply decide(ILoggingEvent event) { + if (event.getLoggerName().contains("InternalLog") && (event.getLevel() == Level.DEBUG || event.getLevel() == Level.TRACE) ) { + return FilterReply.ACCEPT; + } else { + return FilterReply.DENY; + } + } +} diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java index 8ca71187..d29876fb 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java @@ -41,7 +41,9 @@ import java.util.NoSuchElementException; import java.util.Properties;
import java.util.Queue;
import java.util.Set;
-import org.apache.log4j.Logger;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
/**
* Load the DB JDBC driver, and manage a simple pool of connections to the DB.
@@ -51,8 +53,7 @@ import org.apache.log4j.Logger; */
public class DB {
- private static Logger intlogger = Logger
- .getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private static String DB_URL;
private static String DB_LOGIN;
@@ -83,10 +84,10 @@ public class DB { HTTP_PORT = (String) props.get("org.onap.dmaap.datarouter.provserver.http.port");
Class.forName(DB_DRIVER);
} catch (IOException e) {
- intlogger.fatal("PROV9003 Opening properties: " + e.getMessage());
+ intlogger.error("PROV9003 Opening properties: " + e.getMessage());
System.exit(1);
} catch (ClassNotFoundException e) {
- intlogger.fatal("PROV9004 cannot find the DB driver: " + e);
+ intlogger.error("PROV9004 cannot find the DB driver: " + e);
System.exit(1);
}
}
@@ -194,7 +195,7 @@ public class DB { }
} catch (SQLException e) {
intlogger
- .fatal("PROV9000: The database credentials are not working: " + e.getMessage());
+ .error("PROV9000: The database credentials are not working: " + e.getMessage());
return false;
} finally {
if (connection != null) {
@@ -222,7 +223,7 @@ public class DB { rs.close();
}
} catch (SQLException e) {
- intlogger.fatal("PROV9010: Failed to get TABLE data from DB: " + e.getMessage());
+ intlogger.error("PROV9010: Failed to get TABLE data from DB: " + e.getMessage());
}
return tables;
}
@@ -241,7 +242,7 @@ public class DB { try {
String scriptFile = String.format("%s/sql_init_%02d.sql", scriptDir, scriptId);
if (!(new File(scriptFile)).exists()) {
- intlogger.fatal("PROV9005 Failed to load sql script from : " + scriptFile);
+ intlogger.error("PROV9005 Failed to load sql script from : " + scriptFile);
System.exit(1);
}
LineNumberReader lineReader = new LineNumberReader(new FileReader(scriptFile));
@@ -263,7 +264,7 @@ public class DB { lineReader.close();
strBuilder.setLength(0);
} catch (Exception e) {
- intlogger.fatal("PROV9002 Error when initializing table: " + e.getMessage());
+ intlogger.error("PROV9002 Error when initializing table: " + e.getMessage());
System.exit(1);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java index 688a32f6..46cfabec 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java @@ -20,7 +20,8 @@ */ package org.onap.dmaap.datarouter.provisioning.utils; -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; import org.onap.dmaap.datarouter.provisioning.BaseServlet; @@ -38,8 +39,8 @@ import java.io.IOException; public class DRProvCadiFilter extends CadiFilter { - private static Logger eventlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.events"); - private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); + protected static EELFLogger eventlogger = EELFManager.getInstance().getLogger("EventLog"); + protected static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog"); private String aafInstance = ""; public DRProvCadiFilter(boolean init, PropAccess access) throws ServletException { @@ -71,21 +72,21 @@ public class DRProvCadiFilter extends CadiFilter { String message = String.format("Invalid request URI - %s", httpRequest.getPathInfo()); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND, message); return; } if (isAAFSubscriber(subId)) {//edit AAF Subscriber String message = String.format("DRProvCadiFilter - Edit AAF Subscriber : %d : AAF Instance - %s", subId, aafInstance); elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); //request.setAttribute("aafInstance", aafInstance);// no need to set it in request since it is taken care in respective servlets super.doFilter(request, response, chain); } else {//Edit or publish legacy Subscriber String message = "DRProvCadiFilter - Edit/Publish Legacy Subscriber :" + subId; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); chain.doFilter(request, response); } @@ -95,7 +96,7 @@ public class DRProvCadiFilter extends CadiFilter { String message = "Invalid request URI - " + httpRequest.getPathInfo(); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND, message); return; } @@ -103,20 +104,20 @@ public class DRProvCadiFilter extends CadiFilter { if (isAAFFeed(feedId)) {//edit AAF Feed String message = "DRProvCadiFilter - Edit AAF Feed:" + feedId + ":" + "AAF Instance -" + aafInstance; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); super.doFilter(request, response, chain); } else {//Edit or publish legacy Feed String message = "DRProvCadiFilter - Edit/Publish Legacy Feed:" + feedId; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); chain.doFilter(request, response); } } } else {// in all other cases defaults to legacy behavior String message = "DRProvCadiFilter - Default Legacy Feed/Subscriber URI -:" + httpRequest.getPathInfo(); elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); chain.doFilter(request, response); } } else { @@ -127,7 +128,7 @@ public class DRProvCadiFilter extends CadiFilter { String message = "Invalid request URI - " + httpRequest.getPathInfo(); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_NOT_FOUND); - eventlogger.info(elr); + eventlogger.error(elr.toString()); httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND, message); return; } @@ -136,25 +137,25 @@ public class DRProvCadiFilter extends CadiFilter { String message = "DRProvCadiFilter -Invalid request Header Parmeter " + BaseServlet.EXCLUDE_AAF_HEADER + " = " + httpRequest.getHeader(BaseServlet.EXCLUDE_AAF_HEADER); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, message); return; } if (excludeAAF.equalsIgnoreCase("true")) {//Check to add legacy subscriber to AAF Feed String message = "DRProvCadiFilter - add legacy subscriber to AAF Feed, FeedID:" + feedId; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); chain.doFilter(request, response); } else { String message = "DRProvCadiFilter - Add AAF subscriber to AAF Feed, FeedID:" + feedId + ":" + "AAF Instance -" + aafInstance; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); super.doFilter(request, response, chain); } } else {//Add legacy susbcriber to legacy Feed String message = "DRProvCadiFilter - add legacy subscriber to legacy Feed:" + feedId; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); chain.doFilter(request, response); } } else {//add AAF feed @@ -162,19 +163,19 @@ public class DRProvCadiFilter extends CadiFilter { String message = "DRProvCadiFilter -Invalid request Header Parmeter " + BaseServlet.EXCLUDE_AAF_HEADER + " = " + httpRequest.getHeader(BaseServlet.EXCLUDE_AAF_HEADER); elr.setMessage(message); elr.setResult(HttpServletResponse.SC_BAD_REQUEST); - eventlogger.info(elr); + eventlogger.error(elr.toString()); httpResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, message); return; } if (excludeAAF.equalsIgnoreCase("true")) {//add legacy feed String message = "DRProvCadiFilter - Create new legacy Feed : EXCLUDE_AAF = " + excludeAAF; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); chain.doFilter(request, response); } else {//add AAF Feed String message = "DRProvCadiFilter - Create new AAF Feed : EXCLUDE_AAF = " + excludeAAF; elr.setMessage(message); - eventlogger.info(elr); + eventlogger.info(elr.toString()); super.doFilter(request, response, chain); } } @@ -210,7 +211,7 @@ public class DRProvCadiFilter extends CadiFilter { } } catch (Exception e) { - intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: ", e); + intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: ", e.getMessage()); return false; } return false; @@ -240,7 +241,7 @@ public class DRProvCadiFilter extends CadiFilter { intlogger.debug(message); } } catch (Exception e) { - intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: ", e); + intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: ", e.getMessage()); return false; } return false; diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java index ce287f4d..3aa3bd28 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java @@ -25,10 +25,10 @@ package org.onap.dmaap.datarouter.provisioning.utils; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import org.apache.log4j.Logger; +import com.att.eelf.configuration.EELFLogger; public class HttpServletUtils { - public static void sendResponseError(HttpServletResponse response, int errorCode, String message, Logger intlogger) { + public static void sendResponseError(HttpServletResponse response, int errorCode, String message, EELFLogger intlogger) { try { response.sendError(errorCode, message); } catch (IOException ioe) { diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java index 6c5a13fd..82231884 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java @@ -46,7 +46,8 @@ import java.util.Map; import java.util.TreeSet;
import java.util.zip.GZIPInputStream;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.onap.dmaap.datarouter.provisioning.BaseServlet;
import org.onap.dmaap.datarouter.provisioning.beans.DeliveryExtraRecord;
import org.onap.dmaap.datarouter.provisioning.beans.DeliveryRecord;
@@ -106,7 +107,7 @@ public class LogfileLoader extends Thread { */
private static final long SET_SIZE = (1L << 56);
- private final Logger logger;
+ private final EELFLogger logger;
private final DB db;
private final String spooldir;
private final long set_start;
@@ -116,7 +117,7 @@ public class LogfileLoader extends Thread { private boolean idle;
private LogfileLoader() {
- this.logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ this.logger = EELFManager.getInstance().getLogger("InternalLog");
this.db = new DB();
this.spooldir = db.getProperties().getProperty("org.onap.dmaap.datarouter.provserver.spooldir");
this.set_start = getIdRange();
@@ -274,7 +275,7 @@ public class LogfileLoader extends Thread { }
} catch (SQLException e) {
System.err.println(e);
- logger.error(e);
+ logger.error(e.toString());
} finally {
db.release(conn);
}
@@ -296,7 +297,7 @@ public class LogfileLoader extends Thread { }
} catch (SQLException e) {
System.err.println(e);
- logger.error(e);
+ logger.error(e.toString());
} finally {
db.release(conn);
}
@@ -321,7 +322,7 @@ public class LogfileLoader extends Thread { }
} catch (SQLException e) {
System.err.println(e);
- logger.error(e);
+ logger.error(e.toString());
} finally {
db.release(conn);
}
@@ -375,7 +376,7 @@ public class LogfileLoader extends Thread { logger.debug(String.format("initializeNextid, next ID is %d (%x)", nextid, nextid));
} catch (SQLException e) {
System.err.println(e);
- logger.error(e);
+ logger.error(e.toString());
} finally {
db.release(conn);
}
@@ -415,16 +416,16 @@ public class LogfileLoader extends Thread { }
} catch (SQLException e) {
logger.warn("PROV8003 Invalid value in record: " + line);
- logger.debug(e);
+ logger.debug(e.toString());
} catch (NumberFormatException e) {
logger.warn("PROV8004 Invalid number in record: " + line);
- logger.debug(e);
+ logger.debug(e.toString());
} catch (ParseException e) {
logger.warn("PROV8005 Invalid date in record: " + line);
- logger.debug(e);
+ logger.debug(e.toString());
} catch (Exception e) {
logger.warn("PROV8006 Invalid pattern in record: " + line);
- logger.debug(e);
+ logger.debug(e.toString());
}
total++;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java index 14d15197..f3e84b4a 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java @@ -27,7 +27,9 @@ package org.onap.dmaap.datarouter.provisioning.utils; import java.io.File;
import java.util.Properties;
import java.util.TimerTask;
-import org.apache.log4j.Logger;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
/**
* This class provides a {@link TimerTask} that purges old logfiles (older than the number of days specified by the
@@ -42,14 +44,14 @@ public class PurgeLogDirTask extends TimerTask { private final String logdir;
private final long interval;
- private Logger utilsLogger;
+ private EELFLogger utilsLogger;
public PurgeLogDirTask() {
Properties p = (new DB()).getProperties();
logdir = p.getProperty("org.onap.dmaap.datarouter.provserver.accesslog.dir");
String s = p.getProperty("org.onap.dmaap.datarouter.provserver.logretention", "30");
- this.utilsLogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.utils");
+ this.utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");;
long n = 30;
try {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java index 897c1ea2..c9fb5a16 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java @@ -43,7 +43,8 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.eclipse.jetty.continuation.Continuation;
import org.eclipse.jetty.continuation.ContinuationSupport;
import org.eclipse.jetty.server.*;
@@ -101,7 +102,7 @@ public class ThrottleFilter extends TimerTask implements Filter { private static int m_minutes = 0; // sampling period
private static int action = ACTION_DROP; // action to take (throttle or drop)
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
+ private static EELFLogger logger = EELFManager.getInstance().getLogger("InternalLog");
private static Map<String, Counter> map = new HashMap<String, Counter>();
private static final Timer rolex = new Timer();
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java index 3f67efec..65297886 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java @@ -83,7 +83,7 @@ public class FeedReport extends ReportBase { }
db.release(conn);
} catch (SQLException e) {
- logger.error(e);
+ logger.error(e.toString());
}
logger.debug("Query time: " + (System.currentTimeMillis() - start) + " ms");
try (PrintWriter os = new PrintWriter(outfile)) {
@@ -91,7 +91,7 @@ public class FeedReport extends ReportBase { os.print(sb.toString());
} catch (FileNotFoundException e) {
System.err.println("File cannot be written: " + outfile);
- logger.error(e);
+ logger.error(e.toString());
}
}
@@ -130,7 +130,7 @@ public class FeedReport extends ReportBase { feedmap.put("pubcount", n + 1);
} catch (JSONException e) {
feedmap.put("pubcount", 1);
- logger.error(e);
+ logger.error(e.toString());
}
} else if (type.equals("del")) {
String subid = "" + rs.getInt("DELIVERY_SUBID");
@@ -139,7 +139,7 @@ public class FeedReport extends ReportBase { feedmap.put(subid, n + 1);
} catch (JSONException e) {
feedmap.put(subid, 1);
- logger.error(e);
+ logger.error(e.toString());
}
}
}
@@ -147,7 +147,7 @@ public class FeedReport extends ReportBase { }
db.release(conn);
} catch (SQLException e) {
- logger.error(e);
+ logger.error(e.toString());
}
logger.debug("Query time: " + (System.currentTimeMillis() - start) + " ms");
try {
@@ -156,7 +156,7 @@ public class FeedReport extends ReportBase { os.close();
} catch (FileNotFoundException e) {
System.err.println("File cannot be written: " + outfile);
- logger.error(e);
+ logger.error(e.toString());
}
}
@@ -354,7 +354,7 @@ public class FeedReport extends ReportBase { feedmap.put("pubcount", n + count);
} catch (JSONException e) {
feedmap.put("pubcount", count);
- logger.error(e);
+ logger.error(e.toString());
}
} else if (type.equals("del")) {
String subid = tt[3];
@@ -363,7 +363,7 @@ public class FeedReport extends ReportBase { feedmap.put(subid, n + count);
} catch (JSONException e) {
feedmap.put(subid, count);
- logger.error(e);
+ logger.error(e.toString());
}
}
}
@@ -385,7 +385,7 @@ public class FeedReport extends ReportBase { System.out.println(t);
} catch (Exception e) {
System.err.println(e);
- logger.error(e);
+ logger.error(e.toString());
}
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/ReportBase.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/ReportBase.java index d24866c3..e5c86c8e 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/ReportBase.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/ReportBase.java @@ -23,7 +23,8 @@ package org.onap.dmaap.datarouter.reports;
-import org.apache.log4j.Logger;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
/**
* Base class for all the report generating classes.
@@ -34,12 +35,12 @@ import org.apache.log4j.Logger; abstract public class ReportBase implements Runnable {
protected long from, to;
protected String outfile;
- protected Logger logger;
+ protected EELFLogger logger;
public ReportBase() {
this.from = 0;
this.to = System.currentTimeMillis();
- this.logger = Logger.getLogger("org.onap.dmaap.datarouter.reports");
+ this.logger = EELFManager.getInstance().getLogger("ReportLog");;
}
public void setFrom(long from) {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/VolumeReport.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/VolumeReport.java index 8d5731f8..7d5268b1 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/VolumeReport.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/VolumeReport.java @@ -36,7 +36,8 @@ import java.util.HashMap; import java.util.Map; import java.util.TreeSet; -import org.apache.log4j.Logger; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.onap.dmaap.datarouter.provisioning.utils.DB; /** @@ -58,7 +59,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; public class VolumeReport extends ReportBase { private static final String SELECT_SQL = "select EVENT_TIME, TYPE, FEEDID, CONTENT_LENGTH, RESULT" + " from LOG_RECORDS where EVENT_TIME >= ? and EVENT_TIME <= ? LIMIT ?, ?"; - private Logger loggerVolumeReport=Logger.getLogger("org.onap.dmaap.datarouter.reports"); + private EELFLogger loggerVolumeReport= EELFManager.getInstance().getLogger("ReportLog");; private class Counters { int filespublished, filesdelivered, filesexpired; long bytespublished, bytesdelivered, bytesexpired; |