diff options
author | Ralph Straubs <rs8887@att.com> | 2017-04-20 05:26:49 -0500 |
---|---|---|
committer | Ralph Straubs <rs8887@att.com> | 2017-04-20 05:34:06 -0500 |
commit | d5d7dd40f8b29a7a4921829bd6ccf9b670613af2 (patch) | |
tree | c93b970c711255a5468d82426ca1eb90ecdc8811 /common-logging/src/main/java/org/openecomp/policy/common/logging/ECOMPLoggingContext.java | |
parent | c2aad6527c903cc3359ef9673d0706f37d4b89ec (diff) |
Batch submit
[ECOMPD2TD-1073 1707] Removal of extra flush statements and addition
of rollbacks in catch blocks instead of commits.
[ECOMPD2TD-1073 1707] Adding some needed synchronized statements to
IntegrityMonitor.
[ECOMPD2TD-1159] - Loggers should be Serializable
By making loggers Serializable, they can be included in Drools
persistent data. 'EelfLogger' and 'SystemOutLogger' can do this
trivially, but 'Logger4J' needed some additional work, because it has a
non-serializable field 'log'.
[ECOMPD2TD-000] Fix versioning of org.openecomp.policy.* dependencies
[US866186 1707] First cut of stateCheck mod and non-working JUnit
[US866186 1707] Completed the coding for the task TA1998344 which adds
a check of forward progress for dependencies.
[US866186 1707] Completed updates to IntegrityMonitor.stateCheck and
IntegrityMonitorTest which includes addition of a JUnit for stateCheck
and control of the order of JUnit execution.
[US865296] ECOMP Policy Logging Compliance, add TargetEntity and
TargetServiceName, remove unit from ElapsedTime
[US865296] ECOMP Policy Logging Compliance, set audit log statuscode to
'COMPLETE' instead of N/A
[US865296] ECOMP Policy Logging Compliance, remove time unit (seconds
and milliseconds) from ElapsedTime for logging compliance
[US866186 1707] Cleaned up IntegrityAudit JUnit tests.
[US866186 1707] IntegrityMonitor JUnit clean up
[US866186 1707] Re-added missing classes that were erroneously deleted.
[US865296] - add get/setters and inits for required log fields
Change-Id: I76ef4606ed6832ed48eaca68e72839a05c8bc3a8
Signed-off-by: Ralph Straubs <rs8887@att.com>
Diffstat (limited to 'common-logging/src/main/java/org/openecomp/policy/common/logging/ECOMPLoggingContext.java')
-rw-r--r-- | common-logging/src/main/java/org/openecomp/policy/common/logging/ECOMPLoggingContext.java | 113 |
1 files changed, 93 insertions, 20 deletions
diff --git a/common-logging/src/main/java/org/openecomp/policy/common/logging/ECOMPLoggingContext.java b/common-logging/src/main/java/org/openecomp/policy/common/logging/ECOMPLoggingContext.java index 71e75a11..e6e2b1ca 100644 --- a/common-logging/src/main/java/org/openecomp/policy/common/logging/ECOMPLoggingContext.java +++ b/common-logging/src/main/java/org/openecomp/policy/common/logging/ECOMPLoggingContext.java @@ -75,6 +75,10 @@ public class ECOMPLoggingContext { private static final String THREAD_ID = "threadId"; private static final String SERVER_NAME = "serverName"; private static final String SERVICE_NAME = "serviceName"; + private static final String PARTNER_NAME = "partnerName"; + private static final String STATUS_CODE = "statusCode"; + private static final String TARGET_ENTITY = "targetEntity"; + private static final String TARGET_SERVICE_NAME = "targetServiceName"; private static final String INSTANCE_UUID = "instanceUuid"; private static final String SEVERITY = "severity"; private static final String SERVER_IP_ADDRESS = "serverIpAddress"; @@ -123,6 +127,11 @@ public class ECOMPLoggingContext { MDC.clear(); baseContext.context.transferTo(context); transactionStartTime = baseContext.transactionStartTime; + setServiceName("POLICY"); + setPartnerName("USER"); + setStatusCode("COMPLETE"); + setTargetEntity("POLICY"); + setTargetServiceName("PE Process"); } /** @@ -253,6 +262,70 @@ public class ECOMPLoggingContext { } /** + * Set the value for the data item with key "partnerName" + * + * @param id + */ + public void setPartnerName(String name) { + context.put(PARTNER_NAME, name); + } + /** + * Get the value for the data item with key "partnerName" + * @return current value, or empty string if not set + */ + public String getPartnerName() { + return context.get(PARTNER_NAME, ""); + } + + /** + * Set the value for the data item with key "statusCode" + * + * @param id + */ + public void setStatusCode(String name) { + context.put(STATUS_CODE, name); + } + /** + * Get the value for the data item with key "statusCode" + * @return current value, or empty string if not set + */ + public String getStatusCode() { + return context.get(STATUS_CODE, ""); + } + + /** + * Set the value for the data item with key "targetEntity" + * + * @param id + */ + public void setTargetEntity(String name) { + context.put(TARGET_ENTITY, name); + } + /** + * Get the value for the data item with key "targetEntity" + * @return current value, or empty string if not set + */ + public String getTargetEntity() { + return context.get(TARGET_ENTITY, ""); + } + + /** + * Set the value for the data item with key "targetServiceName" + * + * @param id + */ + public void setTargetServiceName(String name) { + context.put(TARGET_SERVICE_NAME, name); + } + /** + * Get the value for the data item with key "targetServiceName" + * @return current value, or empty string if not set + */ + public String getTargetServiceName() { + return context.get(TARGET_SERVICE_NAME, ""); + } + + /** * Set the value for the data item with key "instanceUuid" * * @param id @@ -433,17 +506,17 @@ public class ECOMPLoggingContext { */ public void setTransactionElapsedTime(Instant transactionEndTime) { - long ns = Duration.between(transactionStartTime, transactionEndTime).getSeconds(); - String unit = " Seconds"; - if(ns == 1){ - unit = " Second"; - } + long ns = Duration.between(transactionStartTime, transactionEndTime).toMillis(); + //String unit = " Seconds"; + //if(ns == 1){ + //unit = " Second"; + //} - if(ns < 1){ - ns = Duration.between(transactionStartTime, transactionEndTime).toMillis(); - unit = " milliseconds"; - } - context.put(TRANSACTION_ELAPSED_TIME, ns + unit); + //if(ns < 1){ + //ns = Duration.between(transactionStartTime, transactionEndTime).toMillis(); + //unit = " milliseconds"; + //} + context.put(TRANSACTION_ELAPSED_TIME, ns); // + unit); } /** @@ -506,17 +579,17 @@ public class ECOMPLoggingContext { */ public void setMetricElapsedTime(Instant metricEndTime) { - long ns = Duration.between(metricStartTime, metricEndTime).getSeconds(); - String unit = " Seconds"; - if(ns == 1){ - unit = " Second"; - } + long ns = Duration.between(metricStartTime, metricEndTime).toMillis(); + //String unit = " Seconds"; + //if(ns == 1){ + //unit = " Second"; + //} - if(ns < 1){ - ns = Duration.between(metricStartTime, metricEndTime).toMillis(); - unit = " milliseconds"; - } - context.put(METRIC_ELAPSED_TIME, ns + unit); + //if(ns < 1){ + //ns = Duration.between(metricStartTime, metricEndTime).toMillis(); + //unit = " milliseconds"; + //} + context.put(METRIC_ELAPSED_TIME, ns); // + unit); } /** |