aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--feature-eelf/src/main/feature/config/logback-eelf.xml9
-rw-r--r--policy-management/src/main/server/config/logback.xml9
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransaction.java42
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionConstants.java23
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionImpl.java69
5 files changed, 136 insertions, 16 deletions
diff --git a/feature-eelf/src/main/feature/config/logback-eelf.xml b/feature-eelf/src/main/feature/config/logback-eelf.xml
index 8a7dcb25..7acd33fa 100644
--- a/feature-eelf/src/main/feature/config/logback-eelf.xml
+++ b/feature-eelf/src/main/feature/config/logback-eelf.xml
@@ -2,7 +2,7 @@
============LICENSE_START=======================================================
feature-eelf
================================================================================
- Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -27,14 +27,13 @@
<property name="networkLogName" value="network" />
<property name="defaultPattern"
- value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity:-NA}|%X{TargetServiceName:-NA}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
<property name="defaultMetricPattern"
- value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ value="${defaultPattern}" />
<property name="defaultAuditPattern"
- value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
<property name="defaultErrorPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDescription}|%msg%replace(%xException){'\n',' - '}%nopex%n" />
-
<property name="networkPattern" value="[%d|%t]%m%n" />
<property name="abstractNetworkPattern"
value="[%d] [%X{networkEventType:-NULL}|%X{networkProtocol:-NULL}|%X{networkTopic:-NULL}|%X{requestID:-NULL}]%n" />
diff --git a/policy-management/src/main/server/config/logback.xml b/policy-management/src/main/server/config/logback.xml
index 04ec8937..2d0697d0 100644
--- a/policy-management/src/main/server/config/logback.xml
+++ b/policy-management/src/main/server/config/logback.xml
@@ -2,7 +2,7 @@
============LICENSE_START=======================================================
policy-management
================================================================================
- Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,11 +35,10 @@
<property name="networkPattern" value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%t]%m%n" />
<property name="abstractNetworkPattern"
value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}] [%X{networkEventType:-NULL}|%X{networkProtocol:-NULL}|%X{networkTopic:-NULL}|%X{requestID:-NULL}]%n" />
-
<property name="metricPattern"
- value="%X{RequestID}|%X{InvocationID}|%X{ServiceName}|%X{PartnerName}|%X{BeginTimestamp}|%X{EndTimestamp}|%X{ElapsedTime}|%X{ServiceInstanceID}|%X{VirtualServerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{Severity}|%X{TargetEntity}|%X{TargetServiceName}|%X{Server}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ProcessKey}|%X{RemoteHost}||%X{TargetVirtualEntity}|%level|%thread| %msg%n" />
- <property name="transactionPattern" value="${metricPattern}" />
-
+ value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity:-NA}|%X{TargetServiceName:-NA}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class|%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ <property name="transactionPattern"
+ value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%class|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
<appender name="ErrorOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDir}/${errorLog}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransaction.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransaction.java
index a2cf07fb..94fc9769 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransaction.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransaction.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -197,6 +197,26 @@ public interface MdcTransaction {
MdcTransaction setRemoteHost(String remoteHost);
/**
+ * sets CustomField1 data.
+ */
+ MdcTransaction setCustomField1(String customField1);
+
+ /**
+ * sets CustomField2 data.
+ */
+ MdcTransaction setCustomField2(String customField2);
+
+ /**
+ * sets CustomField3 data.
+ */
+ MdcTransaction setCustomField3(String customField3);
+
+ /**
+ * sets CustomField4 data.
+ */
+ MdcTransaction setCustomField4(String customField4);
+
+ /**
* get start time.
*/
Instant getStartTime();
@@ -312,6 +332,26 @@ public interface MdcTransaction {
String getServerIpAddress();
/**
+ * get customer field1.
+ */
+ String getCustomField1();
+
+ /**
+ * get customer field2.
+ */
+ String getCustomField2();
+
+ /**
+ * get customer field3 which contains notification info.
+ */
+ String getCustomField3();
+
+ /**
+ * get customer field4.
+ */
+ String getCustomField4();
+
+ /**
* generate timestamp used for logging.
*/
String timestamp(Instant time);
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionConstants.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionConstants.java
index eb37d0c7..936449c8 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionConstants.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionConstants.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -144,6 +144,26 @@ public class MdcTransactionConstants {
public static final String TARGET_VIRTUAL_ENTITY = "TargetVirtualEntity";
/**
+ * Custom Field1.
+ */
+ public static final String CUSTOM_FIELD1 = "CustomField1";
+
+ /**
+ * Custom Field2.
+ */
+ public static final String CUSTOM_FIELD2 = "CustomField2";
+
+ /**
+ * Custom Field3.
+ */
+ public static final String CUSTOM_FIELD3 = "CustomField3";
+
+ /**
+ * Custom Field4.
+ */
+ public static final String CUSTOM_FIELD4 = "CustomField4";
+
+ /**
* Default Service Name.
*/
public static final String DEFAULT_SERVICE_NAME = "PDP-D";
@@ -168,7 +188,6 @@ public class MdcTransactionConstants {
*/
public static final String STATUS_CODE_FAILURE = "ERROR";
-
private MdcTransactionConstants() {
// do nothing
}
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionImpl.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionImpl.java
index 4e1690ba..7af6c0cb 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionImpl.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionImpl.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,10 @@ package org.onap.policy.drools.utils.logging;
import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.BEGIN_TIMESTAMP;
import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.CLIENT_IP_ADDRESS;
+import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.CUSTOM_FIELD1;
+import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.CUSTOM_FIELD2;
+import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.CUSTOM_FIELD3;
+import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.CUSTOM_FIELD4;
import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.DEFAULT_HOSTIP;
import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.DEFAULT_HOSTNAME;
import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.DEFAULT_SERVICE_NAME;
@@ -100,6 +104,10 @@ class MdcTransactionImpl implements MdcTransaction {
private String targetVirtualEntity;
private String clientIpAddress;
private String remoteHost;
+ private String customField1;
+ private String customField2;
+ private String customField3;
+ private String customField4;
/**
* Transaction with no information set.
@@ -145,8 +153,8 @@ class MdcTransactionImpl implements MdcTransaction {
this.setServerFqdn(MDC.get(SERVER_FQDN));
this.setVirtualServerName(MDC.get(VIRTUAL_SERVER_NAME));
- this.setStartTime(Instant.now());
this.setInvocationId(invocationId);
+ this.setStartTime(Instant.now());
}
/**
@@ -179,6 +187,10 @@ class MdcTransactionImpl implements MdcTransaction {
this.setTargetServiceName(transaction.getTargetServiceName());
this.setTargetVirtualEntity(transaction.getTargetVirtualEntity());
this.setVirtualServerName(transaction.getVirtualServerName());
+ this.setCustomField1(transaction.getCustomField1());
+ this.setCustomField2(transaction.getCustomField2());
+ this.setCustomField3(transaction.getCustomField3());
+ this.setCustomField4(transaction.getCustomField4());
}
/**
@@ -248,6 +260,10 @@ class MdcTransactionImpl implements MdcTransaction {
setMdc(TARGET_VIRTUAL_ENTITY, this.targetVirtualEntity);
setMdc(CLIENT_IP_ADDRESS, this.clientIpAddress);
setMdc(REMOTE_HOST, this.remoteHost);
+ setMdc(CUSTOM_FIELD1, this.customField1);
+ setMdc(CUSTOM_FIELD2, this.customField2);
+ setMdc(CUSTOM_FIELD3, this.customField3);
+ setMdc(CUSTOM_FIELD4, this.customField4);
return this;
}
@@ -352,6 +368,26 @@ class MdcTransactionImpl implements MdcTransaction {
return this.serviceInstanceId;
}
+ @Override
+ public String getCustomField1() {
+ return this.customField1;
+ }
+
+ @Override
+ public String getCustomField2() {
+ return this.customField2;
+ }
+
+ @Override
+ public String getCustomField3() {
+ return this.customField3;
+ }
+
+ @Override
+ public String getCustomField4() {
+ return this.customField4;
+ }
+
/* transaction and subtransaction fields */
@Override
@@ -458,6 +494,30 @@ class MdcTransactionImpl implements MdcTransaction {
}
@Override
+ public MdcTransaction setCustomField1(String customField1) {
+ this.customField1 = customField1;
+ return this;
+ }
+
+ @Override
+ public MdcTransaction setCustomField2(String customField2) {
+ this.customField2 = customField2;
+ return this;
+ }
+
+ @Override
+ public MdcTransaction setCustomField3(String customField3) {
+ this.customField3 = customField3;
+ return this;
+ }
+
+ @Override
+ public MdcTransaction setCustomField4(String customField4) {
+ this.customField4 = customField4;
+ return this;
+ }
+
+ @Override
public String getInvocationId() {
return invocationId;
}
@@ -641,8 +701,11 @@ class MdcTransactionImpl implements MdcTransaction {
sb.append(", targetVirtualEntity='").append(targetVirtualEntity).append('\'');
sb.append(", clientIpAddress='").append(clientIpAddress).append('\'');
sb.append(", remoteHost='").append(remoteHost).append('\'');
+ sb.append(", customField1='").append(customField1).append('\'');
+ sb.append(", customField2='").append(customField2).append('\'');
+ sb.append(", customField3='").append(customField3).append('\'');
+ sb.append(", customField4='").append(customField4).append('\'');
sb.append('}');
return sb.toString();
}
-
}