summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-08-27 14:37:50 -0400
committerJim Hahn <jrh3@att.com>2019-08-29 17:52:03 -0400
commit60449686fb38104c4232650f7e4423d9d348c221 (patch)
tree2725de3c5967ec2c93c43d1a5a95b9d9997a13ca
parent8f8a41dc02eb7f2c4c1e607fc3cb97f2c04c42e0 (diff)
Remove AlertSeverity from logback in drools-pdp
Merged severity and AlertSeverity in the MDC, and updated the logback xml files accordingly. The logback patterns for the metrics log had a place for both Severity and AlertSeverity; the latter was replaced with an empty place-holder so-as to maintain the same position for the other fields. Change-Id: Ic0977e1133cc4219394f2d71ca8ebae080620e0b Issue-ID: POLICY-1989 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--feature-eelf/src/main/feature/config/logback-eelf.xml10
-rw-r--r--policy-management/src/main/server/config/logback.xml6
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransaction.java10
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionConstants.java5
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/logging/MdcTransactionImpl.java25
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java8
-rw-r--r--policy-utils/src/test/resources/logback-test.xml10
7 files changed, 18 insertions, 56 deletions
diff --git a/feature-eelf/src/main/feature/config/logback-eelf.xml b/feature-eelf/src/main/feature/config/logback-eelf.xml
index 8a577fd1..8a7dcb25 100644
--- a/feature-eelf/src/main/feature/config/logback-eelf.xml
+++ b/feature-eelf/src/main/feature/config/logback-eelf.xml
@@ -7,9 +7,9 @@
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.
@@ -27,11 +27,11 @@
<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{AlertSeverity}|%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}|%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" />
<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{AlertSeverity}|%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}|%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" />
<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{AlertSeverity}|%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}|%X{ClassName}||%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" />
diff --git a/policy-management/src/main/server/config/logback.xml b/policy-management/src/main/server/config/logback.xml
index bf08a5ac..04ec8937 100644
--- a/policy-management/src/main/server/config/logback.xml
+++ b/policy-management/src/main/server/config/logback.xml
@@ -7,9 +7,9 @@
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.
@@ -37,7 +37,7 @@
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{AlertSeverity}|%X{TargetVirtualEntity}|%level|%thread| %msg%n" />
+ 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}" />
<appender name="ErrorOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
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 d56e63e6..a2cf07fb 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
@@ -187,11 +187,6 @@ public interface MdcTransaction {
MdcTransaction setProcessKey(String processKey);
/**
- * sets alert severity.
- */
- MdcTransaction setAlertSeverity(String alertSeverity);
-
- /**
* sets client ip address.
*/
MdcTransaction setClientIpAddress(String clientIpAddress);
@@ -232,11 +227,6 @@ public interface MdcTransaction {
String getClientIpAddress();
/**
- * get alert severity.
- */
- String getAlertSeverity();
-
- /**
* get process key.
*/
String getProcessKey();
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 ba335958..eb37d0c7 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
@@ -139,11 +139,6 @@ public class MdcTransactionConstants {
public static final String REMOTE_HOST = "RemoteHost";
/**
- * Alert Severity Both transactions and subtransactions will have its own copy.
- */
- public static final String ALERT_SEVERITY = "AlertSeverity";
-
- /**
* Target Virtual Entity Both transactions and subtransactions will have its own copy.
*/
public static final String TARGET_VIRTUAL_ENTITY = "TargetVirtualEntity";
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 ac90ab96..4e1690ba 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
@@ -20,7 +20,6 @@
package org.onap.policy.drools.utils.logging;
-import static org.onap.policy.drools.utils.logging.MdcTransactionConstants.ALERT_SEVERITY;
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.DEFAULT_HOSTIP;
@@ -94,7 +93,6 @@ class MdcTransactionImpl implements MdcTransaction {
private String statusCode;
private String responseCode;
private String responseDescription;
- private String theSeverity;
private String alertSeverity;
private String targetEntity;
@@ -158,7 +156,6 @@ class MdcTransactionImpl implements MdcTransaction {
*/
public MdcTransactionImpl(MdcTransaction transaction) {
MDC.clear();
- this.setAlertSeverity(transaction.getAlertSeverity());
this.setClientIpAddress(transaction.getClientIpAddress());
this.setElapsedTime(transaction.getElapsedTime());
this.setEndTime(transaction.getEndTime());
@@ -205,7 +202,6 @@ class MdcTransactionImpl implements MdcTransaction {
MDC.remove(PROCESS_KEY);
MDC.remove(CLIENT_IP_ADDRESS);
MDC.remove(REMOTE_HOST);
- MDC.remove(ALERT_SEVERITY);
MDC.remove(TARGET_VIRTUAL_ENTITY);
return this;
@@ -246,8 +242,7 @@ class MdcTransactionImpl implements MdcTransaction {
setMdc(STATUS_CODE, this.statusCode);
setMdc(RESPONSE_CODE, this.responseCode);
setMdc(RESPONSE_DESCRIPTION, this.responseDescription);
- setMdc(SEVERITY, this.theSeverity);
- setMdc(ALERT_SEVERITY, this.alertSeverity);
+ setMdc(SEVERITY, this.alertSeverity);
setMdc(TARGET_ENTITY, this.targetEntity);
setMdc(TARGET_SERVICE_NAME, this.targetServiceName);
setMdc(TARGET_VIRTUAL_ENTITY, this.targetVirtualEntity);
@@ -306,12 +301,6 @@ class MdcTransactionImpl implements MdcTransaction {
}
@Override
- public MdcTransaction setAlertSeverity(String alertSeverity) {
- this.alertSeverity = alertSeverity;
- return this;
- }
-
- @Override
public MdcTransaction setClientIpAddress(String clientIpAddress) {
this.clientIpAddress = clientIpAddress;
return this;
@@ -354,11 +343,6 @@ class MdcTransactionImpl implements MdcTransaction {
}
@Override
- public String getAlertSeverity() {
- return this.alertSeverity;
- }
-
- @Override
public String getProcessKey() {
return this.processKey;
}
@@ -451,7 +435,7 @@ class MdcTransactionImpl implements MdcTransaction {
@Override
public MdcTransaction setSeverity(String severity) {
- this.theSeverity = severity;
+ this.alertSeverity = severity;
return this;
}
@@ -500,7 +484,7 @@ class MdcTransactionImpl implements MdcTransaction {
@Override
public String getSeverity() {
- return theSeverity;
+ return alertSeverity;
}
@Override
@@ -651,8 +635,7 @@ class MdcTransactionImpl implements MdcTransaction {
sb.append(", statusCode='").append(statusCode).append('\'');
sb.append(", responseCode='").append(responseCode).append('\'');
sb.append(", responseDescription='").append(responseDescription).append('\'');
- sb.append(", severity='").append(theSeverity).append('\'');
- sb.append(", alertSeverity='").append(alertSeverity).append('\'');
+ sb.append(", severity='").append(alertSeverity).append('\'');
sb.append(", targetEntity='").append(targetEntity).append('\'');
sb.append(", targetServiceName='").append(targetServiceName).append('\'');
sb.append(", targetVirtualEntity='").append(targetVirtualEntity).append('\'');
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
index 9c0cf968..76fee77a 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
@@ -66,7 +66,6 @@ public class MdcTransactionTest {
assertNull(MDC.get(MdcTransactionConstants.RESPONSE_CODE));
assertNull(MDC.get(MdcTransactionConstants.RESPONSE_DESCRIPTION));
assertNull(MDC.get(MdcTransactionConstants.SEVERITY));
- assertNull(MDC.get(MdcTransactionConstants.ALERT_SEVERITY));
assertNull(MDC.get(MdcTransactionConstants.TARGET_ENTITY));
assertNull(MDC.get(MdcTransactionConstants.TARGET_SERVICE_NAME));
assertNull(MDC.get(MdcTransactionConstants.TARGET_VIRTUAL_ENTITY));
@@ -100,7 +99,7 @@ public class MdcTransactionTest {
assertNull(trans.getProcessKey());
assertNull(trans.getClientIpAddress());
assertNull(trans.getRemoteHost());
- assertNull(trans.getAlertSeverity());
+ assertNull(trans.getSeverity());
assertNull(trans.getTargetVirtualEntity());
}
@@ -136,7 +135,6 @@ public class MdcTransactionTest {
.setResponseCode("response-code")
.setResponseDescription("response-description")
.setSeverity("severity")
- .setAlertSeverity("alert-severity")
.setTargetEntity("target-entity")
.setTargetServiceName("target-service-name")
.setTargetVirtualEntity("target-virtual-entity")
@@ -157,7 +155,6 @@ public class MdcTransactionTest {
assertNotNull(MDC.get(MdcTransactionConstants.RESPONSE_CODE));
assertNotNull(MDC.get(MdcTransactionConstants.RESPONSE_DESCRIPTION));
assertNotNull(MDC.get(MdcTransactionConstants.SEVERITY));
- assertNotNull(MDC.get(MdcTransactionConstants.ALERT_SEVERITY));
assertNotNull(MDC.get(MdcTransactionConstants.TARGET_ENTITY));
assertNotNull(MDC.get(MdcTransactionConstants.TARGET_SERVICE_NAME));
assertNotNull(MDC.get(MdcTransactionConstants.TARGET_VIRTUAL_ENTITY));
@@ -177,7 +174,6 @@ public class MdcTransactionTest {
assertEquals(trans.getResponseCode(), MDC.get(MdcTransactionConstants.RESPONSE_CODE));
assertEquals(trans.getResponseDescription(), MDC.get(MdcTransactionConstants.RESPONSE_DESCRIPTION));
assertEquals(trans.getSeverity(), MDC.get(MdcTransactionConstants.SEVERITY));
- assertEquals(trans.getAlertSeverity(), MDC.get(MdcTransactionConstants.ALERT_SEVERITY));
assertEquals(trans.getTargetEntity(), MDC.get(MdcTransactionConstants.TARGET_ENTITY));
assertEquals(trans.getTargetServiceName(), MDC.get(MdcTransactionConstants.TARGET_SERVICE_NAME));
assertEquals(trans.getTargetVirtualEntity(), MDC.get(MdcTransactionConstants.TARGET_VIRTUAL_ENTITY));
@@ -190,7 +186,6 @@ public class MdcTransactionTest {
assertEquals("response-code", trans.getResponseCode());
assertEquals("response-description", trans.getResponseDescription());
assertEquals("severity", trans.getSeverity());
- assertEquals("alert-severity", trans.getAlertSeverity());
assertEquals("target-entity", trans.getTargetEntity());
assertEquals("target-service-name", trans.getTargetServiceName());
assertEquals("target-virtual-entity", trans.getTargetVirtualEntity());
@@ -246,7 +241,6 @@ public class MdcTransactionTest {
.setResponseCode("response-code")
.setResponseDescription("response-description")
.setSeverity("severity")
- .setAlertSeverity("alert-severity")
.setTargetEntity("target-entity")
.setTargetServiceName("target-service-name")
.setTargetVirtualEntity("target-virtual-entity")
diff --git a/policy-utils/src/test/resources/logback-test.xml b/policy-utils/src/test/resources/logback-test.xml
index 366a5f67..1a19758e 100644
--- a/policy-utils/src/test/resources/logback-test.xml
+++ b/policy-utils/src/test/resources/logback-test.xml
@@ -2,14 +2,14 @@
============LICENSE_START=======================================================
ONAP
================================================================================
- Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018-2019 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.
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.
@@ -20,7 +20,7 @@
<configuration>
- <property name="pattern" 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{AlertSeverity}|%X{TargetVirtualEntity}|%level|%logger{0}|%thread| %msg%n"/>
+ <property name="pattern" 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|%logger{0}|%thread| %msg%n"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<filter class="org.onap.policy.drools.utils.logging.LoggerMarkerFilter$MetricLoggerMarkerFilter" />
@@ -28,7 +28,7 @@
<Pattern>${pattern}</Pattern>
</encoder>
</appender>
-
+
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>