aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2021-07-28 17:21:35 +0100
committera.sreekumar <ajith.sreekumar@bell.ca>2021-07-29 10:18:20 +0100
commit1036206455218a4722079b749e628ca96825418d (patch)
tree1c8b9fbf00a11f6739800f6a32bb9a007b9215cd
parent7803acd9f4abdf51dc686b68d4706f26af05ea40 (diff)
Improve APEX logging for irrelevant events
When multiple policies are expecting event on the same topic/endpoint, a lot of event parsing failure log messages are generated unnecessarily. With this change, only a 1 line message will be printed if an event cannot be parsed, and the detailed messages will be available at debug level. Change-Id: If1e7460ef5ed86fd470396f1e2ed8cc3c8af70c4 Issue-ID: POLICY-3499 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java3
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java3
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/logback-test.xml3
4 files changed, 8 insertions, 3 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
index acaf483e6..2957a1a11 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -91,7 +92,7 @@ public class ApexKafkaConsumer extends ApexPluginsEventConsumer {
eventReceiver.receiveEvent(new Properties(), record.value());
}
} catch (final Exception e) {
- LOGGER.warn("error receiving events on thread {}", consumerThread.getName(), e);
+ LOGGER.debug("error receiving events on thread {}", consumerThread.getName(), e);
}
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
index fc7c11e9e..4f95c5636 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
@@ -172,7 +172,7 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer {
// Send the event into Apex
eventReceiver.receiveEvent(new Properties(), eventJsonString);
} catch (final Exception e) {
- LOGGER.warn("error receiving events on thread {}", consumerThread.getName(), e);
+ LOGGER.debug("error receiving events on thread {}", consumerThread.getName(), e);
}
}
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
index f49115b38..4e62f5c0f 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
@@ -264,6 +264,9 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable {
} catch (ApexException e) {
if (!iterator.hasNext()) {
final String errorMessage = "Error while converting event into an ApexEvent for " + name;
+ if (!LOGGER.isDebugEnabled()) {
+ LOGGER.warn("{}. Detailed logs are available at debug level.", errorMessage);
+ }
throw new ApexEventException(errorMessage, e);
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/logback-test.xml b/testsuites/integration/integration-uservice-test/src/test/resources/logback-test.xml
index 341a9fdaa..1fa56526f 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/logback-test.xml
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/logback-test.xml
@@ -3,6 +3,7 @@
============LICENSE_START=======================================================
Copyright (C) 2016-2018 Ericsson. All rights reserved.
Modifications Copyright (C) 2020 Nordix Foundation.
+ Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -36,7 +37,7 @@
</root>
- <logger name="org.onap.policy.apex" level="INFO" additivity="false">
+ <logger name="org.onap.policy.apex" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT" />
</logger>