diff options
author | 2021-01-13 12:26:35 +0000 | |
---|---|---|
committer | 2021-01-13 17:53:17 +0000 | |
commit | 5f233e2e307e5202bfe1f319185f0880d354cb67 (patch) | |
tree | b64ef887a5a7a82699806955bca528d382853c30 /services/services-engine/src/main/java/org/onap | |
parent | d05021ebfc7a7f57cb88a5e380b403118ceeaa13 (diff) |
Avoiding unwanted logging in APEX during event processing
Change-Id: If0c93bfea08025c6c10e3f4572a14088990f415f
Issue-ID: POLICY-2885
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'services/services-engine/src/main/java/org/onap')
3 files changed, 7 insertions, 26 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java index 6e4c6d5d2..5f44be82f 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/Apex2ApexEventConverter.java @@ -1,19 +1,20 @@ /*- * ============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. * 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. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -60,7 +61,6 @@ public class Apex2ApexEventConverter implements ApexEventProtocolConverter { public List<ApexEvent> 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"); } @@ -102,8 +102,7 @@ public class Apex2ApexEventConverter implements ApexEventProtocolConverter { eventList.add(event); } } catch (final Exception e) { - final String errorString = "Failed to unmarshal APEX event: " + e.getMessage() + ", event=" + eventObject; - LOGGER.warn(errorString, e); + final String errorString = "Failed to unmarshal APEX event, event=" + eventObject; throw new ApexEventException(errorString, e); } @@ -118,7 +117,6 @@ public class Apex2ApexEventConverter 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"); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java index 1cca52a3d..db9a7663c 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.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. @@ -32,8 +33,6 @@ import org.onap.policy.apex.service.engine.event.ApexEvent; import org.onap.policy.apex.service.engine.event.ApexEventConverter; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; /** * The Class ApexEvent2EnEventConverter converts externally facing {@link ApexEvent} instances to @@ -42,7 +41,6 @@ import org.slf4j.ext.XLoggerFactory; * @author Liam Fallon (liam.fallon@ericsson.com) */ public final class ApexEvent2EnEventConverter implements ApexEventConverter { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexEvent2EnEventConverter.class); // The Apex engine with its event definitions private final ApexEngine apexEngine; @@ -63,7 +61,6 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter { public List<ApexEvent> toApexEvent(final String eventName, final Object event) throws ApexException { // Check the Engine event if (event == null) { - LOGGER.warn("event processing failed, engine event is null"); throw new ApexEventException("event processing failed, engine event is null"); } @@ -74,7 +71,6 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter { enEvent = (EnEvent) event; } catch (final Exception e) { final String errorMessage = "error transferring event \"" + event + "\" to the Apex engine"; - LOGGER.debug(errorMessage, e); throw new ApexEventRuntimeException(errorMessage, e); } @@ -107,14 +103,12 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter { public EnEvent fromApexEvent(final ApexEvent apexEvent) throws ApexException { // Check the Apex model if (apexEngine == null) { - LOGGER.warn("event processing failed, apex engine is null"); throw new ApexEventException("event processing failed, apex engine is null"); } // Get the event definition final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(apexEvent.getName()); if (eventDefinition == null) { - LOGGER.warn("event processing failed, event \"" + apexEvent.getName() + "\" not found in apex model"); throw new ApexEventException( "event processing failed, event \"" + apexEvent.getName() + "\" not found in apex model"); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java index e8e592b09..06d9b477f 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.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. @@ -67,7 +68,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { // Check and get the JSON parameters if (!(parameters instanceof JsonEventProtocolParameters)) { final String errorMessage = "specified consumer properties are not applicable to the JSON event protocol"; - LOGGER.warn(errorMessage); throw new ApexEventRuntimeException(errorMessage); } @@ -81,7 +81,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { public List<ApexEvent> 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"); } @@ -92,7 +91,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { jsonEventString = (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); } @@ -160,7 +158,6 @@ public class Apex2JsonEventConverter 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"); } @@ -204,7 +201,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { if (!eventField.getOptional()) { final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. " + "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent; - LOGGER.debug(errorMessage); throw new ApexEventRuntimeException(errorMessage); } continue; @@ -237,7 +233,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { if (eventDefinition.getFields().isEmpty()) { final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json, Field " + jsonPars.getPojoField() + " not found, no fields defined on event."; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } @@ -245,7 +240,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json, Field " + jsonPars.getPojoField() + ", " + " one and only one field may be defined on a POJO event definition."; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } @@ -254,7 +248,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { if (!jsonPars.getPojoField().equals(pojoFieldDefinition.getKey().getLocalName())) { final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. Field " + jsonPars.getPojoField() + " not found on POJO event definition."; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } @@ -332,7 +325,6 @@ public class Apex2JsonEventConverter 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; @@ -365,7 +357,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { if (eventDefinition.getFields().isEmpty()) { final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json, Field " + jsonPars.getPojoField() + " not found, no fields defined on event."; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } @@ -373,7 +364,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json, Field " + jsonPars.getPojoField() + ", one and only one field may be defined on a POJO event definition."; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } @@ -382,7 +372,6 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter { if (!jsonPars.getPojoField().equals(pojoFieldDefinition.getKey().getLocalName())) { final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json. Field " + jsonPars.getPojoField() + " not found on POJO event definition."; - LOGGER.debug(errorMessage); throw new ApexEventException(errorMessage); } |