From 5f233e2e307e5202bfe1f319185f0880d354cb67 Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Wed, 13 Jan 2021 12:26:35 +0000 Subject: Avoiding unwanted logging in APEX during event processing Change-Id: If0c93bfea08025c6c10e3f4572a14088990f415f Issue-ID: POLICY-2885 Signed-off-by: a.sreekumar --- .../event/protocol/jms/Apex2JmsObjectEventConverter.java | 6 +----- .../plugins/event/protocol/jms/Apex2JmsTextEventConverter.java | 7 +------ .../plugins/event/protocol/xml/Apex2XmlEventConverter.java | 10 +--------- .../plugins/event/protocol/yaml/Apex2YamlEventConverter.java | 7 +------ 4 files changed, 4 insertions(+), 26 deletions(-) (limited to 'plugins/plugins-event/plugins-event-protocol') diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java index f50a1dc1d..0f3a21bdc 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 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. @@ -82,7 +83,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv } catch (Exception e) { final String errorMessage = "message \"" + eventObject + "\" received from JMS does not have a \"getObject()\" method"; - LOGGER.warn(errorMessage, e); throw new ApexEventRuntimeException(errorMessage); } @@ -92,7 +92,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv } catch (final Exception e) { final String errorMessage = "object contained in message \"" + eventObject + "\" received from JMS could not be retrieved as a Java object"; - LOGGER.debug(errorMessage, e); throw new ApexEventRuntimeException(errorMessage, e); } @@ -100,7 +99,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv if (eventProtocolParameters == null) { final String errorMessage = "consumer parameters for JMS events consumed by " + "Apex are not set in the Apex configuration for this engine"; - LOGGER.debug(errorMessage); throw new ApexEventRuntimeException(errorMessage); } @@ -130,7 +128,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException { // Check the Apex event if (apexEvent == null) { - LOGGER.warn("event processing failed, Apex event is null"); throw new ApexEventException("event processing failed, Apex event is null"); } @@ -138,7 +135,6 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv if (apexEvent.size() != 1) { final String errorMessage = "event processing failed, " + "Apex event must have one and only one parameter for JMS Object handling"; - LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); } diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java index fcd54978e..e9f9109c0 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsTextEventConverter.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * 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. @@ -26,8 +27,6 @@ import org.onap.policy.apex.service.engine.event.ApexEvent; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.Apex2JsonEventConverter; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; /** * The Class Apex2JMSTextEventConverter converts {@link ApexEvent} instances into string instances of @@ -37,7 +36,6 @@ import org.slf4j.ext.XLoggerFactory; * @author Liam Fallon (liam.fallon@ericsson.com) */ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(Apex2JmsTextEventConverter.class); /** * {@inheritDoc}. @@ -52,7 +50,6 @@ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter { } catch (Exception e) { final String errorMessage = "message \"" + eventObject + "\" received from JMS does not have a \"getText()\" method"; - LOGGER.warn(errorMessage, e); throw new ApexEventRuntimeException(errorMessage); } @@ -63,7 +60,6 @@ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter { } catch (final Exception e) { final String errorMessage = "object contained in message \"" + eventObject + "\" received from JMS could not be retrieved as a Java String"; - LOGGER.debug(errorMessage, e); throw new ApexEventRuntimeException(errorMessage, e); } @@ -78,7 +74,6 @@ public final class Apex2JmsTextEventConverter extends Apex2JsonEventConverter { public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException { // Check the Apex event if (apexEvent == null) { - LOGGER.warn("event processing failed, Apex event is null"); throw new ApexEventException("event processing failed, Apex event is null"); } diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java index 0f6735e0e..af4b7815a 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * 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. @@ -44,8 +45,6 @@ import org.onap.policy.apex.service.engine.event.ApexEventProtocolConverter; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters; import org.onap.policy.common.utils.resources.ResourceUtils; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; import org.xml.sax.SAXException; /** @@ -55,7 +54,6 @@ import org.xml.sax.SAXException; * @author Liam Fallon (liam.fallon@ericsson.com) */ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(Apex2XmlEventConverter.class); private static final String MODEL_SCHEMA_NAME = "xml/apex-event.xsd"; @@ -87,7 +85,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.setSchema(apexEventSchema); } catch (JAXBException | SAXException e) { - LOGGER.error("Unable to set up marshalling and unmarshalling for XML events", e); throw new ApexEventException("Unable to set up marshalling and unmarshalling for XML events", e); } } @@ -107,7 +104,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter public List toApexEvent(final String eventName, final Object eventObject) throws ApexEventException { // Check the XML event if (eventObject == null) { - LOGGER.warn("event processing failed, XML event is null"); throw new ApexEventException("event processing failed, XML event is null"); } @@ -117,7 +113,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter xmlEventString = (String) eventObject; } catch (final Exception e) { final String errorMessage = "error converting event \"" + eventObject + "\" to a string"; - LOGGER.debug(errorMessage, e); throw new ApexEventRuntimeException(errorMessage, e); } @@ -155,7 +150,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter public String fromApexEvent(final ApexEvent apexEvent) throws ApexEventException { // Check the Apex event if (apexEvent == null) { - LOGGER.warn("event processing failed, Apex event is null"); throw new ApexEventException("event processing failed, Apex event is null"); } @@ -172,7 +166,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter } } } catch (final Exception e) { - LOGGER.warn("Unable to transfer Apex event data to XML\n" + apexEvent, e); throw new ApexEventException("Unable to transfer Apex event data to XML\n" + apexEvent, e); } @@ -189,7 +182,6 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter // Return the event as XML in a string return writer.toString(); } catch (final JAXBException e) { - LOGGER.warn("Unable to unmarshal Apex event to XML\n" + apexEvent, e); throw new ApexEventException("Unable to unmarshal Apex event to XML\n" + apexEvent, e); } } diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java index 59c9c21c1..faae7527c 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/src/main/java/org/onap/policy/apex/plugins/event/protocol/yaml/Apex2YamlEventConverter.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 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. @@ -61,7 +62,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { // Check and get the YAML parameters if (!(parameters instanceof YamlEventProtocolParameters)) { final String errorMessage = "specified consumer properties are not applicable to the YAML event protocol"; - LOGGER.warn(errorMessage); throw new ApexEventRuntimeException(errorMessage); } @@ -75,7 +75,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { public List toApexEvent(final String eventName, final Object eventObject) throws ApexEventException { // Check the event eventObject if (eventObject == null) { - LOGGER.warn("event processing failed, event is null"); throw new ApexEventException("event processing failed, event is null"); } @@ -83,7 +82,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { // always work if (!(eventObject instanceof String)) { final String errorMessage = "error converting event \"" + eventObject + "\" to a string"; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } @@ -127,7 +125,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { public Object fromApexEvent(final ApexEvent apexEvent) throws ApexEventException { // Check the Apex event if (apexEvent == null) { - LOGGER.warn("event processing failed, Apex event is null"); throw new ApexEventException("event processing failed, Apex event is null"); } @@ -155,7 +152,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { if (!eventField.getOptional()) { final String errorMessage = "error parsing " + eventDefinition.getId() + " event to Json. " + "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent; - LOGGER.debug(errorMessage); throw new ApexEventRuntimeException(errorMessage); } continue; @@ -192,7 +188,6 @@ public class Apex2YamlEventConverter implements ApexEventProtocolConverter { if (!eventField.getOptional()) { final String errorMessage = "error parsing " + eventDefinition.getId() + " event from Json. " + "Field \"" + fieldName + "\" is missing, but is mandatory."; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } continue; -- cgit 1.2.3-korg