summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-12-12 19:13:28 +0000
committerGerrit Code Review <gerrit@onap.org>2017-12-12 19:13:28 +0000
commitaa9e865ccf191e814b50b8b4b51d516fc359d948 (patch)
treedf3614682a8d8e268d697e87ad90b879496f3e2e
parent0368cb99d6108970d172d4dc7145c67e4524b4a9 (diff)
parentf799af84c1777d1b56641c758bdf6064b494d71d (diff)
Merge "Fix audit log to contain ending timestamp"
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java3
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java2
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java4
3 files changed, 5 insertions, 4 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
index ab0492312..7f612a57e 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
@@ -373,6 +373,7 @@ public class DeleteHandler {
}
}
if (responseString.equals("success")) {
+ loggingContext.transactionEnded();
PolicyLogger.info("Policy successfully deleted!");
PolicyLogger.audit("Policy successfully deleted!");
response.setStatus(HttpServletResponse.SC_OK);
@@ -449,8 +450,8 @@ public class DeleteHandler {
}
if (response==null){
response = "success";
+ loggingContext.transactionEnded();
PolicyLogger.audit("Policy successfully deleted!");
- PolicyLogger.audit("Transaction Ended Successfully");
}
loggingContext.transactionEnded();
PolicyLogger.audit("Transaction Ended");
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java
index 14b312f6d..49400d615 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java
@@ -248,8 +248,8 @@ public class XACMLPdpRegisterThread implements Runnable {
}
} catch (Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+ loggingContext.transactionEnded();
PolicyLogger.audit("Transaction Failed - See Error.log");
- loggingContext.transactionEnded();
papUrls.failed();
} finally {
// cleanup the connection
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
index b824312dc..04572ccbc 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
@@ -229,8 +229,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
baseLoggingContext = new ONAPLoggingContext();
// fixed data that will be the same in all logging output goes here
try {
- String ipaddress = InetAddress.getLocalHost().getHostAddress();
- baseLoggingContext.setServer(ipaddress);
+ String hostname = InetAddress.getLocalHost().getCanonicalHostName();
+ baseLoggingContext.setServer(hostname);
} catch (UnknownHostException e) {
logger.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get hostname for logging"+e);
}