fix debug log 78/102178/7 1.0.0
authorKai <lukai@chinamobile.com>
Sat, 22 Feb 2020 07:54:23 +0000 (15:54 +0800)
committerLUKAI <lukai@chinamobile.com>
Tue, 25 Feb 2020 03:17:03 +0000 (03:17 +0000)
Issue-ID: DCAEGEN2-2077
Signed-off-by: Kai Lu <lukai@chinamobile.com>
Change-Id: Ice1b21ae478a6311f6202cac48ba10dc1b859bc3

24 files changed:
dcae-analytics/dcae-analytics-model/pom.xml
dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/DmaapMrConstants.java
dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java
dcae-analytics/dcae-analytics-tca-core/src/main/java/org/onap/dcae/analytics/tca/core/exception/AnalyticsParsingException.java [moved from dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/exception/AnalyticsParsingException.java with 95% similarity]
dcae-analytics/dcae-analytics-tca-core/src/main/java/org/onap/dcae/analytics/tca/core/util/LogSpec.java [new file with mode: 0644]
dcae-analytics/dcae-analytics-tca-core/src/main/java/org/onap/dcae/analytics/tca/core/util/TcaUtils.java [moved from dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/util/TcaUtils.java with 96% similarity]
dcae-analytics/dcae-analytics-tca-core/src/main/java/org/onap/dcae/analytics/tca/core/util/function/calculation/TcaAbatementCalculator.java
dcae-analytics/dcae-analytics-tca-core/src/main/java/org/onap/dcae/analytics/tca/core/util/function/calculation/TcaCalculationFunction.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/aai/TcaAaiEnrichmentServiceImpl.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/abatement/mongo/MongoAbatementEntity.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/abatement/simple/SimpleAbatementEntity.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/controller/TcaRestController.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/domain/TcaPolicyWrapper.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaAlertTransformer.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandler.java
dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingServiceImpl.java
dcae-analytics/dcae-analytics-tca-web/src/main/resources/logback.xml
dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/service/TcaProcessingServiceImplTest.java
dcae-analytics/dcae-analytics-web/pom.xml
dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/config/DmaapMrConfig.java
dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrMessageSplitter.java
dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdvice.java
dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/dmaap/MrTriggerMessageProvider.java
dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java

index fc6c32d..c7d6ddb 100644 (file)
                 <scope>provided</scope>
         </dependency>
 
+               <dependency>
+                       <groupId>org.onap.dcaegen2.analytics.tca-gen2</groupId>
+                       <artifactId>eelf-logger-logback-impl</artifactId>
+               </dependency>
+
        </dependencies>
 
 </project>
index 26f2210..ca14ff6 100644 (file)
@@ -30,13 +30,6 @@ public abstract class DmaapMrConstants {
 
     // ================== DMaaP MR CONSTANTS ============================== //
 
-    public static final Set<String> DMAAP_MAPPED_HEADERS = Stream.of(
-            AnalyticsHttpConstants.REQUEST_ID_HEADER_KEY,
-            AnalyticsHttpConstants.REQUEST_TRANSACTION_ID_HEADER_KEY,
-            AnalyticsHttpConstants.REQUEST_BEGIN_TS_HEADER_KEY,
-            AnalyticsHttpConstants.REQUEST_END_TS_HEADER_KEY).collect(Collectors.toSet());
-
-
     // MR SUBSCRIBER
     public static final String SUBSCRIBER_EMPTY_MESSAGE_RESPONSE_STRING = "[]";
     public static final String SUBSCRIBER_RANDOM_CONSUMER_GROUP_PREFIX = "DCAE-SUB-";
@@ -67,4 +60,15 @@ public abstract class DmaapMrConstants {
     private DmaapMrConstants() {
         // private constructor
     }
+
+    /**
+     * getDmaapmappedHeaders
+     */
+    public static final Set<String> getDmaapmappedHeaders () {
+         return Stream.of(
+                AnalyticsHttpConstants.REQUEST_ID_HEADER_KEY,
+                AnalyticsHttpConstants.REQUEST_TRANSACTION_ID_HEADER_KEY,
+                AnalyticsHttpConstants.REQUEST_BEGIN_TS_HEADER_KEY,
+                AnalyticsHttpConstants.REQUEST_END_TS_HEADER_KEY).collect(Collectors.toSet());
+    }
 }
index 7384e97..423e951 100644 (file)
@@ -40,8 +40,6 @@ public abstract class ConfigBindingServiceConstants {
     public static final String ENV_CBS_PORT = "CONFIG_BINDING_SERVICE_SERVICE_PORT";
     public static final String CONFIG_BINDING_SERVICE_PROPERTIES_KEY = "config-binding-service";
 
-    public static final Set<String> SPRING_RESERVED_PROPERTIES_KEY_PREFIXES =
-            Stream.of("spring", "endpoints", "server", "logging", "management").collect(Collectors.toSet());
     public static final String CONFIG_SERVICE_MESSAGE_ROUTER_VALUE = "message_router";
     // CONVERT JSON TO MAP
     public static final String KEY_SEPARATOR = ".";
@@ -86,4 +84,11 @@ public abstract class ConfigBindingServiceConstants {
     private ConfigBindingServiceConstants() {
         // private constructor
     }
+
+    /**
+     * getSpringReservedPropertiesKeyPrefixes
+     */
+    public static final Set<String> getSpringReservedPropertiesKeyPrefixes() {
+        return Stream.of("spring", "endpoints", "server", "logging", "management").collect(Collectors.toSet());
+    }
 }
diff --git a/dcae-analytics/dcae-analytics-tca-core/src/main/java/org/onap/dcae/analytics/tca/core/util/LogSpec.java b/dcae-analytics/dcae-analytics-tca-core/src/main/java/org/onap/dcae/analytics/tca/core/util/LogSpec.java
new file mode 100644 (file)
index 0000000..002cf07
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 China Mobile. 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.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.dcae.analytics.tca.core.util;
+
+import java.util.Date;
+
+import org.onap.dcae.analytics.model.TcaModelConstants;
+import org.onap.dcae.analytics.model.ecomplogger.AnalyticsErrorType;
+import org.onap.dcae.utils.eelf.logger.api.info.ErrorLogInfo;
+import org.onap.dcae.utils.eelf.logger.api.info.ResponseLogInfo;
+import org.onap.dcae.utils.eelf.logger.api.info.TargetServiceLogInfo;
+import org.onap.dcae.utils.eelf.logger.api.spec.AuditLogSpec;
+import org.onap.dcae.utils.eelf.logger.api.spec.DebugLogSpec;
+import org.onap.dcae.utils.eelf.logger.api.spec.ErrorLogSpec;
+import org.onap.dcae.utils.eelf.logger.model.info.ErrorLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.info.RequestIdLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.info.RequestTimingLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.info.ResponseLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.info.TargetServiceLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.spec.AuditLogSpecImpl;
+import org.onap.dcae.utils.eelf.logger.model.spec.DebugLogSpecImpl;
+import org.onap.dcae.utils.eelf.logger.model.spec.ErrorLogSpecImpl;
+
+/**
+ * @author Kai Lu
+ */
+public final class LogSpec {
+
+    private LogSpec( ) {
+        // private constructor
+    }
+
+    /**
+     * create ErrorLogSpec
+     *
+     * @param requestId requestId
+     *
+     * @return ErrorLogSpecImpl object
+     *
+     */
+    public static ErrorLogSpec createErrorLogSpec(final String requestId) {
+        final RequestIdLogInfoImpl requestIdLogInfo = new RequestIdLogInfoImpl(requestId);
+        final TargetServiceLogInfo targetServiceLogInfo = new TargetServiceLogInfoImpl(
+                "DCAE-TCA", TcaModelConstants.TCA_SERVICE_NAME, "");
+        final ErrorLogInfo errorLogInfo =
+                new ErrorLogInfoImpl(AnalyticsErrorType.SCHEMA_ERROR.getErrorCode(),
+                        AnalyticsErrorType.SCHEMA_ERROR.getErrorDescription());
+        return new ErrorLogSpecImpl(requestIdLogInfo,
+                TcaUtils.TCA_SERVICE_LOG_INFO, targetServiceLogInfo, errorLogInfo);
+    }
+
+    /**
+     * create DebugLogSpec
+     *
+     * @param requestId requestId
+     *
+     * @return DebugLogSpecImpl object
+     *
+     */
+    public static DebugLogSpec createDebugLogSpec(final String requestId) {
+        final RequestIdLogInfoImpl requestIdLogInfo = new RequestIdLogInfoImpl(requestId);
+        return new DebugLogSpecImpl(requestIdLogInfo);
+    }
+
+    /**
+     * create AuditLogSpec
+     *
+     * @param requestId requestId
+     * @param requestBeginTimestamp requestBeginTimestamp
+     *
+     * @return AuditLogSpec object
+     *
+     */
+    public static AuditLogSpec createAuditLogSpec(final String requestId,
+                                                  final Date requestBeginTimestamp) {
+        final RequestIdLogInfoImpl requestIdLogInfo = new RequestIdLogInfoImpl(requestId);
+        final Date endTimestamp = new Date();
+        final RequestTimingLogInfoImpl requestTimingLogInfo = new RequestTimingLogInfoImpl(requestBeginTimestamp,
+                endTimestamp, endTimestamp.getTime() - requestBeginTimestamp.getTime());
+        final ResponseLogInfo responseLogInfo =
+                new ResponseLogInfoImpl(AnalyticsErrorType.SUCCESSFUL.getErrorCode(),
+                        AnalyticsErrorType.SUCCESSFUL.getErrorDescription());
+        return new AuditLogSpecImpl(requestIdLogInfo, TcaUtils.TCA_SERVICE_LOG_INFO,
+                requestTimingLogInfo, responseLogInfo);
+    }
+
+}
@@ -17,7 +17,7 @@
  *
  */
 
-package org.onap.dcae.analytics.tca.web.util;
+package org.onap.dcae.analytics.tca.core.util;
 
 import static org.onap.dcae.analytics.tca.model.util.json.TcaModelJsonConversion.TCA_OBJECT_MAPPER;
 
@@ -30,8 +30,8 @@ import java.util.stream.Collectors;
 
 import org.onap.dcae.analytics.model.TcaModelConstants;
 import org.onap.dcae.analytics.model.cef.EventListener;
+import org.onap.dcae.analytics.tca.core.exception.AnalyticsParsingException;
 import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
-import org.onap.dcae.analytics.web.exception.AnalyticsParsingException;
 import org.onap.dcae.utils.eelf.logger.model.info.ServiceLogInfoImpl;
 
 /**
index 0322456..3dff203 100644 (file)
@@ -36,15 +36,17 @@ import org.onap.dcae.analytics.tca.core.service.TcaResultContext;
 import org.onap.dcae.analytics.tca.model.policy.ClosedLoopEventStatus;
 import org.onap.dcae.analytics.tca.model.policy.MetricsPerEventName;
 import org.onap.dcae.analytics.tca.model.policy.Threshold;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger;
+import org.onap.dcae.utils.eelf.logger.model.info.RequestIdLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.spec.DebugLogSpecImpl;
 
 /**
  * @author Rajiv Singla
  */
 public class TcaAbatementCalculator implements TcaCalculationFunction {
 
-    private static final Logger logger = LoggerFactory.getLogger(TcaAbatementCalculator.class);
+    private static final EELFLogger logger = EELFLogFactory.getLogger(TcaAbatementCalculator.class);
 
     @Override
     public TcaExecutionContext calculate(final TcaExecutionContext tcaExecutionContext) {
@@ -70,8 +72,8 @@ public class TcaAbatementCalculator implements TcaCalculationFunction {
         final ClosedLoopEventStatus closedLoopEventStatus = violatedThreshold.getClosedLoopEventStatus();
         final String requestId = tcaExecutionContext.getRequestId();
         final String lookupKey = createLookupKey(eventListener, violatedMetricsPerEventName);
-
-
+        final RequestIdLogInfoImpl requestIdLogInfo = new RequestIdLogInfoImpl(requestId);
+        final DebugLogSpecImpl debugLogSpec = new DebugLogSpecImpl(requestIdLogInfo);
         switch (closedLoopEventStatus) {
 
             // ONSET - save alert info in database so that next abated event can fetch its request id for abated
@@ -80,9 +82,9 @@ public class TcaAbatementCalculator implements TcaCalculationFunction {
 
                 final TcaAbatementEntity tcaAbatementEntity =
                         abatementContext.create(lookupKey, requestId, false);
-                logger.debug("Request Id: {}. Alert ClosedLoop Status is ONSET. " +
+                logger.debugLog().debug("Request Id: {}. Alert ClosedLoop Status is ONSET. " +
                                 "Saving abatement Entity to repository with lookupKey: {}",
-                        requestId, tcaAbatementEntity.getLookupKey());
+                                debugLogSpec, requestId, tcaAbatementEntity.getLookupKey());
                 abatementPersistenceContext.save(tcaAbatementEntity);
                 return tcaExecutionContext;
 
@@ -99,8 +101,8 @@ public class TcaAbatementCalculator implements TcaCalculationFunction {
                     final TcaAbatementEntity previousTcaAbatementEntity =
                             previousTcaAbatementEntities.get(previousTcaAbatementEntities.size() - 1);
 
-                    logger.debug("Request Id: {}. Found previous Abatement Entity: {}", requestId,
-                            previousTcaAbatementEntity);
+                    logger.debugLog().debug("Request Id: {}. Found previous Abatement Entity with lookupKey: {}",
+                            debugLogSpec, requestId, previousTcaAbatementEntity.getLookupKey());
 
                     // previous abatement entity was found - but it was already sent before - so ignore alert creation
                     if (previousTcaAbatementEntity.isAbatementAlertSent()) {
@@ -113,14 +115,14 @@ public class TcaAbatementCalculator implements TcaCalculationFunction {
                     // no previous abatement was sent
                     final String previousRequestId = previousTcaAbatementEntity.getRequestId();
                     // set abated alert request id to previous ONSET alert request id
-                    logger.debug("Request Id: {}. No previous abated alert was sent. Setting previous request id: {}",
-                            requestId, previousRequestId);
+                    logger.debugLog().debug("Request Id: {}. No previous abated alert was sent. Setting previous request id: {}",
+                            debugLogSpec, requestId, previousRequestId);
                     resultContext.setPreviousRequestId(previousRequestId);
                     // save new entity with alert as sent
                     final TcaAbatementEntity newTcaAbatementEntity =
                             abatementContext.create(lookupKey, previousRequestId, true);
-                    logger.debug("Request Id: {}. Saving new entity with alert as sent: {}",
-                            requestId, newTcaAbatementEntity);
+                    logger.debugLog().debug("Request Id: {}. Saving new entity with alert as sent with lookupKey: {}",
+                            debugLogSpec, requestId, newTcaAbatementEntity.getLookupKey());
                     abatementPersistenceContext.save(newTcaAbatementEntity);
                     return tcaExecutionContext;
 
index ec9f7bd..d24bfe1 100644 (file)
@@ -21,10 +21,20 @@ package org.onap.dcae.analytics.tca.core.util.function.calculation;
 
 import java.util.function.Function;
 
+import org.onap.dcae.analytics.model.TcaModelConstants;
+import org.onap.dcae.analytics.model.ecomplogger.AnalyticsErrorType;
 import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
 import org.onap.dcae.analytics.tca.core.service.TcaProcessingContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.dcae.analytics.tca.core.util.TcaUtils;
+import org.onap.dcae.utils.eelf.logger.api.info.ErrorLogInfo;
+import org.onap.dcae.utils.eelf.logger.api.info.TargetServiceLogInfo;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger;
+import org.onap.dcae.utils.eelf.logger.model.info.ErrorLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.info.RequestIdLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.info.TargetServiceLogInfoImpl;
+import org.onap.dcae.utils.eelf.logger.model.spec.DebugLogSpecImpl;
+import org.onap.dcae.utils.eelf.logger.model.spec.ErrorLogSpecImpl;
 
 /**
  * Functional interface which all TCA calculation functions should implement
@@ -34,11 +44,10 @@ import org.slf4j.LoggerFactory;
 @FunctionalInterface
 public interface TcaCalculationFunction extends Function<TcaExecutionContext, TcaExecutionContext> {
 
-    Logger logger = LoggerFactory.getLogger(TcaCalculationFunction.class);
+    EELFLogger logger = EELFLogFactory.getLogger(TcaCalculationFunction.class);
 
     TcaExecutionContext calculate(TcaExecutionContext tcaExecutionContext);
 
-
     default TcaExecutionContext preCalculation(TcaExecutionContext tcaExecutionContext) {
         // do nothing
         return tcaExecutionContext;
@@ -69,12 +78,24 @@ public interface TcaCalculationFunction extends Function<TcaExecutionContext, Tc
                                                       final TcaExecutionContext tcaExecutionContext,
                                                       final boolean isErrorMessage) {
         final TcaProcessingContext tcaProcessingContext = tcaExecutionContext.getTcaProcessingContext();
+
+        final RequestIdLogInfoImpl requestIdLogInfo = new RequestIdLogInfoImpl(tcaExecutionContext.getRequestId());
+
         if (isErrorMessage) {
-            logger.error("Request Id: {}. Error Message: {}", tcaExecutionContext.getRequestId(), terminatingMessage);
+            final TargetServiceLogInfo targetServiceLogInfo = new TargetServiceLogInfoImpl(
+                    "DCAE-TCA", TcaModelConstants.TCA_SERVICE_NAME, "");
+            final ErrorLogInfo errorLogInfo =
+                    new ErrorLogInfoImpl(AnalyticsErrorType.SCHEMA_ERROR.getErrorCode(),
+                            AnalyticsErrorType.SCHEMA_ERROR.getErrorDescription());
+            final ErrorLogSpecImpl errorLogSpec = new ErrorLogSpecImpl(requestIdLogInfo,
+                    TcaUtils.TCA_SERVICE_LOG_INFO, targetServiceLogInfo, errorLogInfo);
+            logger.errorLog().error("Request Id: {}. Error Message: {}",
+                    errorLogSpec, tcaExecutionContext.getRequestId(), terminatingMessage);
             tcaProcessingContext.setErrorMessage(terminatingMessage);
         } else {
-            logger.debug("Request Id: {}. Early Termination Message: {}", tcaExecutionContext.getRequestId(),
-                    terminatingMessage);
+            final DebugLogSpecImpl debugLogSpec = new DebugLogSpecImpl(requestIdLogInfo);
+            logger.debugLog().debug("Request Id: {}. Early Termination Message: {}",
+                    debugLogSpec, tcaExecutionContext.getRequestId(), terminatingMessage);
             tcaProcessingContext.setEarlyTerminationMessage(terminatingMessage);
         }
         tcaProcessingContext.setContinueProcessing(false);
index d38bd23..ccaacba 100644 (file)
@@ -21,8 +21,6 @@ package org.onap.dcae.analytics.tca.web.aai;
 
 import static org.onap.dcae.analytics.tca.model.util.json.TcaModelJsonConversion.TCA_OBJECT_MAPPER;
 
-import com.fasterxml.jackson.databind.JsonNode;
-
 import java.io.IOException;
 import java.net.URI;
 import java.util.Collections;
@@ -34,11 +32,14 @@ import org.onap.dcae.analytics.model.AnalyticsHttpConstants;
 import org.onap.dcae.analytics.model.TcaModelConstants;
 import org.onap.dcae.analytics.tca.core.service.TcaAaiEnrichmentService;
 import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
+import org.onap.dcae.analytics.tca.core.util.LogSpec;
 import org.onap.dcae.analytics.tca.model.facade.Aai;
 import org.onap.dcae.analytics.tca.model.facade.TcaAlert;
 import org.onap.dcae.analytics.tca.web.TcaAppProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger;
+import org.onap.dcae.utils.eelf.logger.api.spec.DebugLogSpec;
+import org.onap.dcae.utils.eelf.logger.api.spec.ErrorLogSpec;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
@@ -47,12 +48,14 @@ import org.springframework.util.StringUtils;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.util.UriComponentsBuilder;
 
+import com.fasterxml.jackson.databind.JsonNode;
+
 /**
  * @author Rajiv Singla
  */
 public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
 
-    private static final Logger logger = LoggerFactory.getLogger(TcaAaiEnrichmentServiceImpl.class);
+    private static final EELFLogger logger = EELFLogFactory.getLogger(TcaAaiEnrichmentServiceImpl.class);
 
     private final TcaAppProperties tcaAppProperties;
     private final RestTemplate aaiRestTemplate;
@@ -100,7 +103,7 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
 
         // get resource link
         final String resourceLink =
-                getVMResourceLink(getAAIRestAPIResponse(aaiRestTemplate, nodeQueryUri, requestId, transactionId));
+                getVMResourceLink(requestId, getAAIRestAPIResponse(aaiRestTemplate, nodeQueryUri, requestId, transactionId));
         if (resourceLink == null) {
             return;
         }
@@ -115,7 +118,7 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
                 getAAIRestAPIResponse(aaiRestTemplate, vServerEnrichmentUri, requestId, transactionId);
 
         // do aai enrichment
-        enrichAAI(vServerEnrichmentDetails, tcaAlert, TcaModelConstants.AAI_VSERVER_KEY_PREFIX);
+        enrichAAI(requestId, vServerEnrichmentDetails, tcaAlert, TcaModelConstants.AAI_VSERVER_KEY_PREFIX);
     }
 
     private static void doAaiVnfEnrichment(final TcaExecutionContext tcaExecutionContext,
@@ -138,7 +141,7 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
         final String aaiResponse = getAAIRestAPIResponse(aaiRestTemplate, genericVnfUri, requestId, transactionId);
 
         // do AAI enrichment
-        enrichAAI(aaiResponse, tcaAlert, TcaModelConstants.AAI_VNF_KEY_PREFIX);
+        enrichAAI(requestId, aaiResponse, tcaAlert, TcaModelConstants.AAI_VNF_KEY_PREFIX);
     }
 
 
@@ -162,7 +165,9 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
             final HttpEntity<String> httpEntity = new HttpEntity<>(headers);
             aaiResponseEntity = aaiRestTemplate.exchange(aaiUri, HttpMethod.GET, httpEntity, String.class);
         } catch (Exception e) {
-            logger.debug("Request id: " + requestId + ". Unable to get A&AI enrichment details", e);
+            final ErrorLogSpec errorLogSpec = LogSpec.createErrorLogSpec(requestId);
+            logger.errorLog().error("Request id: " + requestId + ". Unable to get A&AI enrichment details",
+                    errorLogSpec, e.toString());
         }
 
         if (aaiResponseEntity != null && aaiResponseEntity.getStatusCode().is2xxSuccessful()) {
@@ -182,17 +187,20 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
      *
      * @return true if A&AI enrichment completed successfully
      */
-    private static boolean enrichAAI(final String aaiEnrichmentDetails, final TcaAlert tcaAlert,
+    private static boolean enrichAAI(final String requestId, final String aaiEnrichmentDetails, final TcaAlert tcaAlert,
                                      final String keyPrefix) {
 
         final Aai preEnrichmentAAI = tcaAlert.getAai();
+        final ErrorLogSpec errorLogSpec = LogSpec.createErrorLogSpec(requestId);
+        final DebugLogSpec debugLogSpec = LogSpec.createDebugLogSpec(requestId);
+
         if (aaiEnrichmentDetails == null) {
-            logger.warn("Request id: {}. No A&AI Enrichment possible. A&AI Enrichment details are absent.",
-                    tcaAlert.getRequestId());
+            logger.errorLog().error("Request id: {}. No A&AI Enrichment possible. A&AI Enrichment details are absent.",
+                    errorLogSpec, tcaAlert.getRequestId());
             return false;
         }
 
-        final Aai enrichedAAI = getNewEnrichedAAI(aaiEnrichmentDetails);
+        final Aai enrichedAAI = getNewEnrichedAAI(requestId, aaiEnrichmentDetails);
 
         if (enrichedAAI != null) {
             final Set<Map.Entry<String, Object>> enrichedAAIEntrySet =
@@ -205,11 +213,12 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
                         keyPrefix + enrichedAAIEntry.getKey(), enrichedAAIEntry.getValue());
             }
 
-            logger.debug("Request id: {}. A&AI Enrichment was completed successfully.", tcaAlert.getRequestId());
+            logger.debugLog().debug("Request id: {}. A&AI Enrichment was completed successfully.",
+                    debugLogSpec, tcaAlert.getRequestId());
             return true;
         } else {
-            logger.warn("Request id: {}. No A&AI Enrichment possible. Skipped - Invalid A&AI Response.",
-                    tcaAlert.getRequestId());
+            logger.errorLog().error("Request id: {}. No A&AI Enrichment possible. Skipped - Invalid A&AI Response.",
+                    errorLogSpec, tcaAlert.getRequestId());
             return false;
         }
 
@@ -222,7 +231,7 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
      *
      * @return new A&AI with only top level A&AI Enrichment details
      */
-    private static Aai getNewEnrichedAAI(final String aaiEnrichmentDetails) {
+    private static Aai getNewEnrichedAAI(final String requestId, final String aaiEnrichmentDetails) {
         try {
             final JsonNode rootNode = TCA_OBJECT_MAPPER.readTree(aaiEnrichmentDetails);
             final Iterator<Map.Entry<String, JsonNode>> fieldsIterator = rootNode.fields();
@@ -236,8 +245,10 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
             }
             return TCA_OBJECT_MAPPER.treeToValue(rootNode, Aai.class);
         } catch (IOException e) {
-            logger.error(
-                    "Failed to Parse AAI Enrichment Details from JSON: {}, Exception: {}.", aaiEnrichmentDetails, e);
+            final ErrorLogSpec errorLogSpec = LogSpec.createErrorLogSpec(requestId);
+            logger.errorLog().error(
+                    "Failed to Parse AAI Enrichment Details from JSON: {}, Exception: {}.",
+                    errorLogSpec, aaiEnrichmentDetails, e.toString());
         }
         return null;
     }
@@ -249,7 +260,7 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
      *
      * @return object resource link String
      */
-    private static String getVMResourceLink(final String vmAAIResourceLinkDetails) {
+    private static String getVMResourceLink(final String requestId, final String vmAAIResourceLinkDetails) {
         if (StringUtils.hasText(vmAAIResourceLinkDetails)) {
             try {
                 final JsonNode jsonNode = TCA_OBJECT_MAPPER.readTree(vmAAIResourceLinkDetails);
@@ -258,8 +269,9 @@ public class TcaAaiEnrichmentServiceImpl implements TcaAaiEnrichmentService {
                     return resourceLinkJsonNode.asText();
                 }
             } catch (IOException e) {
-                logger.error("Unable to determine VM Object link inside AAI Resource Link Response JSON: {}",
-                        vmAAIResourceLinkDetails, e);
+                final ErrorLogSpec errorLogSpec = LogSpec.createErrorLogSpec(requestId);
+                logger.errorLog().error("Unable to determine VM Object link inside AAI Resource Link Response JSON: {}",
+                        errorLogSpec, vmAAIResourceLinkDetails, e.toString());
             }
         }
         return null;
index 0cc1fcf..82c32ec 100644 (file)
@@ -37,8 +37,6 @@ import org.springframework.data.mongodb.core.mapping.Document;
 @Document(collection = "tca_abatement")
 public class MongoAbatementEntity implements TcaAbatementEntity, TcaModel {
 
-    private static final long serialVersionUID = 1L;
-
     @Id
     private String lookupKey;
     private String requestId;
index 42e3759..e1880ac 100644 (file)
@@ -32,8 +32,6 @@ import org.onap.dcae.analytics.tca.model.TcaModel;
 @Data
 public class SimpleAbatementEntity implements TcaAbatementEntity, TcaModel {
 
-    private static final long serialVersionUID = 1L;
-
     protected String lookupKey;
     protected String requestId;
     protected boolean isAbatementAlertSent;
index eb9eb13..0d34f90 100644 (file)
@@ -19,9 +19,6 @@
 
 package org.onap.dcae.analytics.tca.web.controller;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
 import java.time.format.DateTimeFormatter;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -30,12 +27,12 @@ import org.onap.dcae.analytics.model.TcaModelConstants;
 import org.onap.dcae.analytics.model.common.ConfigSource;
 import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
 import org.onap.dcae.analytics.tca.core.service.TcaResultContext;
+import org.onap.dcae.analytics.tca.core.util.TcaUtils;
 import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
 import org.onap.dcae.analytics.tca.model.restapi.TcaExecutionRequest;
 import org.onap.dcae.analytics.tca.model.restapi.TcaExecutionResponse;
 import org.onap.dcae.analytics.tca.web.domain.TcaPolicyWrapper;
 import org.onap.dcae.analytics.tca.web.service.TcaProcessingService;
-import org.onap.dcae.analytics.tca.web.util.TcaUtils;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -44,6 +41,9 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
 /**
  * @author Rajiv Singla
  */
index c54d27c..fcfc3fe 100644 (file)
@@ -25,10 +25,10 @@ import java.time.ZonedDateTime;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.onap.dcae.analytics.model.common.ConfigSource;
+import org.onap.dcae.analytics.tca.core.exception.AnalyticsParsingException;
 import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
 import org.onap.dcae.analytics.tca.model.policy.TcaPolicyModel;
 import org.onap.dcae.analytics.tca.web.TcaAppProperties;
-import org.onap.dcae.analytics.web.exception.AnalyticsParsingException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index 59acd2d..9bade85 100644 (file)
@@ -29,9 +29,9 @@ import org.onap.dcae.analytics.model.AnalyticsHttpConstants;
 import org.onap.dcae.analytics.model.TcaModelConstants;
 import org.onap.dcae.analytics.model.ecomplogger.AnalyticsErrorType;
 import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
+import org.onap.dcae.analytics.tca.core.util.TcaUtils;
 import org.onap.dcae.analytics.tca.model.facade.TcaAlert;
 import org.onap.dcae.analytics.tca.web.TcaAppProperties;
-import org.onap.dcae.analytics.tca.web.util.TcaUtils;
 import org.onap.dcae.analytics.web.util.AnalyticsHttpUtils;
 import org.onap.dcae.utils.eelf.logger.api.info.ErrorLogInfo;
 import org.onap.dcae.utils.eelf.logger.api.info.ResponseLogInfo;
@@ -150,10 +150,11 @@ public class TcaAlertTransformer extends AbstractTransformer {
         final AuditLogSpecImpl auditLogSpec = new AuditLogSpecImpl(requestIdLogInfo, TcaUtils.TCA_SERVICE_LOG_INFO,
                 requestTimingLogInfo, responseLogInfo);
         logger.auditLog().info("Request Id: {}, Transaction Id: {}, " +
-                        "Message counts - Received: {}, Errors: {}, Terminated Early: {}, Abated: {}, Alerts: {}",
+                        "Message counts - Received: {}, Errors: {}, Terminated Early: {}, Abated: {}, Alerts: {}, Alerts size: {}",
                 auditLogSpec, requestId, transactionId,
                 Integer.toString(tcaExecutionContexts.size()), Integer.toString(errorExecutionContexts.size()),
                 Integer.toString(earlyTerminationExecutionContexts.size()),
+                tcaAlerts.toString(),
                 Integer.toString(abatedExecutionContexts.size()), Integer.toString(tcaAlerts.size()));
     }
 }
index 0e81a28..7cd542c 100644 (file)
@@ -27,8 +27,8 @@ import java.util.Date;
 import java.util.Map;
 
 import org.onap.dcae.analytics.model.ecomplogger.AnalyticsErrorType;
+import org.onap.dcae.analytics.tca.core.util.TcaUtils;
 import org.onap.dcae.analytics.tca.web.TcaAppProperties;
-import org.onap.dcae.analytics.tca.web.util.TcaUtils;
 import org.onap.dcae.analytics.web.util.AnalyticsHttpUtils;
 import org.onap.dcae.utils.eelf.logger.api.info.ResponseLogInfo;
 import org.onap.dcae.utils.eelf.logger.api.log.EELFLogFactory;
index 3bb742a..f5aec0b 100644 (file)
@@ -34,9 +34,9 @@ import org.onap.dcae.analytics.tca.core.service.GenericTcaResultContext;
 import org.onap.dcae.analytics.tca.core.service.TcaAaiEnrichmentContext;
 import org.onap.dcae.analytics.tca.core.service.TcaAbatementContext;
 import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
+import org.onap.dcae.analytics.tca.core.util.TcaUtils;
 import org.onap.dcae.analytics.tca.core.util.function.calculation.TcaCalculator;
 import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
-import org.onap.dcae.analytics.tca.web.util.TcaUtils;
 
 /**
  * @author Rajiv Singla
index 5430f0b..63625a5 100644 (file)
@@ -37,7 +37,7 @@
     <logger name="com.jayway" level="INFO"/>
 
     <logger name="org.springframework.retry" level="INFO"/>
-    <logger name="org.onap.dcae.analytics" level="INFO"/>
+    <logger name="org.onap.dcae.analytics" level="DEBUG"/>
 
     <root level="DEBUG">
         <!-- required appenders -->
index 426ae46..9347d53 100644 (file)
@@ -25,16 +25,12 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.junit.jupiter.api.Test;
+import org.onap.dcae.analytics.tca.core.exception.AnalyticsParsingException;
 import org.onap.dcae.analytics.tca.core.service.TcaAaiEnrichmentContext;
 import org.onap.dcae.analytics.tca.core.service.TcaAbatementContext;
 import org.onap.dcae.analytics.tca.core.service.TcaExecutionContext;
 import org.onap.dcae.analytics.tca.model.facade.TcaAlert;
 import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
-import org.onap.dcae.analytics.tca.web.TcaAppProperties;
-import org.onap.dcae.analytics.tca.web.domain.TcaPolicyWrapper;
-import org.onap.dcae.analytics.web.exception.AnalyticsParsingException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 
index d331f45..7744f3f 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>dcae-analytics-model</artifactId>
         </dependency>
+        <!-- PROJECT DEPENDENCIES -->
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>dcae-analytics-tca-core</artifactId>
+        </dependency>
 
         <!-- ECOMP LOGGER -->
         <dependency>
index 97fdcc5..1fe9e51 100644 (file)
@@ -63,7 +63,7 @@ import org.springframework.web.client.RestTemplate;
 public class DmaapMrConfig {
 
     private static final String[] DMAAP_MAPPED_REQUEST_HEADERS =
-            DmaapMrConstants.DMAAP_MAPPED_HEADERS.toArray(new String[DmaapMrConstants.DMAAP_MAPPED_HEADERS.size()]);
+            DmaapMrConstants.getDmaapmappedHeaders().toArray(new String[DmaapMrConstants.getDmaapmappedHeaders().size()]);
 
     @Bean(name = DmaapMrConstants.DMAAP_MR_SUBSCRIBER_OUTPUT_CHANNEL_NAME)
     public QueueChannel mrSubscriberOutputChannel(final BasicMessageGroupStore basicMessageGroupStore) {
index fe8f7ed..0396005 100644 (file)
@@ -24,11 +24,9 @@ import static org.apache.commons.text.StringEscapeUtils.unescapeJson;
 import static org.onap.dcae.analytics.model.AnalyticsHttpConstants.REQUEST_ID_HEADER_KEY;
 import static org.onap.dcae.analytics.model.AnalyticsModelConstants.ANALYTICS_REQUEST_ID_DELIMITER;
 
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
 import java.io.IOException;
 import java.util.Collections;
+import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.stream.IntStream;
@@ -36,15 +34,22 @@ import java.util.stream.IntStream;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import org.onap.dcae.analytics.model.AnalyticsHttpConstants;
 import org.onap.dcae.analytics.model.DmaapMrConstants;
-import org.onap.dcae.analytics.web.exception.AnalyticsParsingException;
+import org.onap.dcae.analytics.tca.core.exception.AnalyticsParsingException;
+import org.onap.dcae.analytics.tca.core.util.LogSpec;
 import org.onap.dcae.analytics.web.util.AnalyticsHttpUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger;
+import org.onap.dcae.utils.eelf.logger.api.spec.AuditLogSpec;
+import org.onap.dcae.utils.eelf.logger.api.spec.ErrorLogSpec;
 import org.springframework.integration.splitter.AbstractMessageSplitter;
 import org.springframework.integration.support.MessageBuilder;
 import org.springframework.messaging.Message;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
 /**
  * DMaaP MR message splitter split the incoming messages into batch of given batch size
  *
@@ -52,7 +57,7 @@ import org.springframework.messaging.Message;
  */
 public class MrMessageSplitter extends AbstractMessageSplitter {
 
-    private static final Logger logger = LoggerFactory.getLogger(MrMessageSplitter.class);
+    private static final EELFLogger eelfLogger = EELFLogFactory.getLogger(MrMessageSplitter.class);
 
     private final ObjectMapper objectMapper;
     private final Integer batchSize;
@@ -66,18 +71,23 @@ public class MrMessageSplitter extends AbstractMessageSplitter {
     @Override
     protected Object splitMessage(final Message<?> message) {
 
-        final List<String> dmaapMessages = convertJsonToStringMessages(String.class.cast(message.getPayload()).trim());
-
         final String requestId = AnalyticsHttpUtils.getRequestId(message.getHeaders());
+        final List<String> dmaapMessages = convertJsonToStringMessages(requestId, String.class.cast(message.getPayload()).trim());
+
         final String transactionId = AnalyticsHttpUtils.getTransactionId(message.getHeaders());
 
-        logger.info("Request Id: {}, Transaction Id: {}, Received new messages from DMaaP MR. Count: {}",
-                requestId, transactionId, dmaapMessages.size());
+        final Date requestBeginTimestamp = AnalyticsHttpUtils.getTimestampFromHeaders(message.getHeaders(),
+                AnalyticsHttpConstants.REQUEST_BEGIN_TS_HEADER_KEY);
+        final AuditLogSpec auditLogSpec = LogSpec.createAuditLogSpec(requestId, requestBeginTimestamp);
 
-        final List<List<String>> messagePartitions = partition(dmaapMessages, batchSize);
+        eelfLogger.auditLog().info("Request Id: {}, Transaction Id: {}, dmaapMessages: {},"
+                + " Received new messages from DMaaP MR. Count: {}",
+                auditLogSpec, requestId, transactionId, dmaapMessages.toString(), String.valueOf(dmaapMessages.size()));
 
-        logger.debug("Request Id: {}, Transaction Id: {},  Max allowed messages per batch: {}. " +
-                "No of batches created: {}", requestId, transactionId, batchSize, messagePartitions.size());
+        final List<List<String>> messagePartitions = partition(dmaapMessages, batchSize);
+        eelfLogger.auditLog().info("Request Id: {}, Transaction Id: {},  Max allowed messages per batch: {}. " +
+                "No of batches created: {}",
+                auditLogSpec, requestId, transactionId, String.valueOf(batchSize), String.valueOf(messagePartitions.size()));
 
         // append batch id to request id header
         return messagePartitions.isEmpty() ? null : IntStream.range(0, messagePartitions.size())
@@ -100,7 +110,7 @@ public class MrMessageSplitter extends AbstractMessageSplitter {
      *
      * @return List containing DMaaP MR Messages
      */
-    private List<String> convertJsonToStringMessages(@Nullable final String messagesJsonString) {
+    private List<String> convertJsonToStringMessages(String requestId, @Nullable final String messagesJsonString) {
 
         final LinkedList<String> messages = new LinkedList<>();
 
@@ -128,9 +138,11 @@ public class MrMessageSplitter extends AbstractMessageSplitter {
                 }
 
             } catch (IOException e) {
-                final String errorMessage = String.format("Unable to convert subscriber Json String to Messages. " +
+                ErrorLogSpec errorLogSpec = LogSpec.createErrorLogSpec(requestId);
+                eelfLogger.errorLog().error("Unable to convert subscriber Json String to Messages. " +
+                        "Subscriber Response String: {}, Json Error: {}", errorLogSpec, messagesJsonString, e.toString());
+                String errorMessage = String.format("Unable to convert subscriber Json String to Messages. " +
                         "Subscriber Response String: %s, Json Error: %s", messagesJsonString, e);
-                logger.error(errorMessage, e);
                 throw new AnalyticsParsingException(errorMessage, e);
             }
 
@@ -183,6 +195,4 @@ public class MrMessageSplitter extends AbstractMessageSplitter {
         }
         return result;
     }
-
-
 }
index 33115c5..2ebb38d 100644 (file)
@@ -24,9 +24,11 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.onap.dcae.analytics.model.AnalyticsHttpConstants;
 import org.onap.dcae.analytics.model.DmaapMrConstants;
+import org.onap.dcae.analytics.tca.core.util.LogSpec;
 import org.onap.dcae.analytics.web.util.AnalyticsHttpUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger;
+import org.onap.dcae.utils.eelf.logger.api.spec.DebugLogSpec;
 import org.springframework.http.HttpStatus;
 import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
 import org.springframework.integration.support.MessageBuilder;
@@ -48,7 +50,7 @@ import org.springframework.messaging.Message;
  */
 public class MrSubscriberPollingAdvice extends AbstractRequestHandlerAdvice {
 
-    private static final Logger log = LoggerFactory.getLogger(MrSubscriberPollingAdvice.class);
+    private static final EELFLogger eelfLogger = EELFLogFactory.getLogger(MrSubscriberPollingAdvice.class);
 
     private final DynamicPeriodicTrigger trigger;
     private final int minPollingInterval;
@@ -112,17 +114,17 @@ public class MrSubscriberPollingAdvice extends AbstractRequestHandlerAdvice {
 
             final String requestId = AnalyticsHttpUtils.getRequestId(message.getHeaders());
             final String transactionId = AnalyticsHttpUtils.getTransactionId(message.getHeaders());
-
-            log.debug("Request Id: {}, Transaction Id: {}, Messages Present: {}, " +
-                            "Next Polling Interval will be: {}", requestId, transactionId,
-                    areMessagesPresent, nextPollingInterval);
+            final DebugLogSpec debugLogSpec = LogSpec.createDebugLogSpec(requestId);
+            eelfLogger.debugLog().debug("Request Id: {}, Transaction Id: {}, Messages Present: {}, " +
+                            "Next Polling Interval will be: {}", debugLogSpec, requestId, transactionId,
+                            String.valueOf(areMessagesPresent), nextPollingInterval.toString());
 
             trigger.setPeriod(nextPollingInterval.get());
 
             // if no messages were found in dmaap poll - terminate further processing
             if (!areMessagesPresent) {
-                log.info("Request Id: {}, Transaction Id: {}, No new messages found in DMaaP MR Response. " +
-                        "No further processing required", requestId, transactionId);
+                eelfLogger.debugLog().debug("Request Id: {}, Transaction Id: {}, No new messages found in DMaaP MR Response. " +
+                        "No further processing required", debugLogSpec, requestId, transactionId);
                 return null;
             }
 
index 183957d..b537170 100644 (file)
@@ -26,10 +26,12 @@ import java.util.function.Supplier;
 
 import org.onap.dcae.analytics.model.AnalyticsHttpConstants;
 import org.onap.dcae.analytics.model.util.supplier.UnboundedSupplier;
+import org.onap.dcae.analytics.tca.core.util.LogSpec;
 import org.onap.dcae.analytics.web.util.AnalyticsWebUtils;
 import org.onap.dcae.analytics.web.util.function.MrSubscriberURLFunction;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogFactory;
+import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger;
+import org.onap.dcae.utils.eelf.logger.api.spec.DebugLogSpec;
 import org.springframework.integration.support.MessageBuilder;
 import org.springframework.messaging.Message;
 
@@ -40,7 +42,7 @@ import org.springframework.messaging.Message;
  */
 public class MrTriggerMessageProvider {
 
-    private static final Logger logger = LoggerFactory.getLogger(MrTriggerMessageProvider.class);
+    private static final EELFLogger logger = EELFLogFactory.getLogger(MrTriggerMessageProvider.class);
 
     public static final String TRIGGER_METHOD_NAME = "getTriggerMessage";
 
@@ -60,8 +62,9 @@ public class MrTriggerMessageProvider {
         final String requestId = AnalyticsWebUtils.REQUEST_ID_SUPPLIER.get();
         final String transactionId = AnalyticsWebUtils.RANDOM_ID_SUPPLIER.get();
         final String beginTimestamp = AnalyticsWebUtils.CREATION_TIMESTAMP_SUPPLIER.get();
-        logger.debug("Request Id: {}. Transaction Id: {}. Begin TS: {}. Starting new DMaaP MR Subscriber poll.",
-                requestId, transactionId, beginTimestamp);
+        final DebugLogSpec debugLogSpec = LogSpec.createDebugLogSpec(requestId);
+        logger.debugLog().debug("Request Id: {}. Transaction Id: {}. Begin TS: {}. Starting new DMaaP MR Subscriber poll.",
+                debugLogSpec, requestId, transactionId, beginTimestamp);
         return MessageBuilder
                 .withPayload(subscriberUrlSupplier.get().toString())
                 .setHeader(AnalyticsHttpConstants.REQUEST_ID_HEADER_KEY, requestId)
index d643de2..31c01b0 100644 (file)
@@ -240,7 +240,7 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment
 
             // remove config service key prefix on spring reserved property key prefixes
             final Set<String> springKeyPrefixes =
-                    ConfigBindingServiceConstants.SPRING_RESERVED_PROPERTIES_KEY_PREFIXES;
+                    ConfigBindingServiceConstants.getSpringReservedPropertiesKeyPrefixes();
             final Set<String> springKeys = springKeyPrefixes.stream()
                     .map(springKeyPrefix -> configServicePropertiesKey + "." + springKeyPrefix)
                     .collect(Collectors.toSet());