Remove Excessive Logging from DMI Stub 60/141260/2
authorToineSiebelink <toine.siebelink@est.tech>
Thu, 12 Jun 2025 16:35:59 +0000 (17:35 +0100)
committerToineSiebelink <toine.siebelink@est.tech>
Mon, 16 Jun 2025 07:33:28 +0000 (08:33 +0100)
- Changed most info level logging to debug-level (10,000s of occurrences)
- Changed some info level logging for problems to warn-level (0 occurrences anyway)
- Removed Configuration i.e. disabled Springboot Built-In Request Logging

Issue-ID: CPS-2816
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Change-Id: Ice0e2ac0d425de02d1d872cc7f3173746c2f029c

dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/aop/ModuleInitialProcessAspect.java
dmi-stub/dmi-stub-service/src/main/resources/application.yml

index cf18f23..6a8530f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2023-2024 Nordix Foundation
+ *  Copyright (C) 2023-2025 OpenInfra Foundation Europe. 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.
@@ -211,14 +211,14 @@ public class DmiRestStubController {
             @RequestParam(value = "topic", required = false) final String topic,
             @RequestHeader(value = "Authorization", required = false) final String authorization,
             @RequestBody final String requestBody) {
-        log.info("DMI AUTH HEADER: {}", authorization);
+        log.debug("DMI AUTH HEADER: {}", authorization);
         final String passthroughOperationType = getPassthroughOperationType(requestBody);
         if (passthroughOperationType.equals("read")) {
             delay(readDataForCmHandleDelayMs);
         } else {
             delay(writeDataForCmHandleDelayMs);
         }
-        log.info("Logging request body {}", requestBody);
+        log.debug("Logging request body {}", requestBody);
 
         final String sampleJson = ResourceFileReaderUtil.getResourceFileContent(applicationContext.getResource(
                 ResourceLoader.CLASSPATH_URL_PREFIX + "data/ietf-network-topology-sample-rfc8345.json"));
@@ -240,15 +240,15 @@ public class DmiRestStubController {
             @RequestBody final DmiDataOperationRequest dmiDataOperationRequest) {
         delay(writeDataForCmHandleDelayMs);
         try {
-            log.info("Request received from the NCMP to DMI Plugin: {}",
+            log.debug("Request received from the NCMP to DMI Plugin: {}",
                     objectMapper.writeValueAsString(dmiDataOperationRequest));
         } catch (final JsonProcessingException jsonProcessingException) {
-            log.info("Unable to process dmi data operation request to json string");
+            log.warn("Unable to process dmi data operation request to json string");
         }
         dmiDataOperationRequest.getOperations().forEach(dmiDataOperation -> {
             final DataOperationEvent dataOperationEvent = getDataOperationEvent(dmiDataOperation);
             dmiDataOperation.getCmHandles().forEach(dmiOperationCmHandle -> {
-                log.info("Module Set Tag received: {}", dmiOperationCmHandle.getModuleSetTag());
+                log.debug("Module Set Tag received: {}", dmiOperationCmHandle.getModuleSetTag());
                 dataOperationEvent.getData().getResponses().get(0).setIds(List.of(dmiOperationCmHandle.getId()));
                 final CloudEvent cloudEvent = buildAndGetCloudEvent(topic, requestId, dataOperationEvent);
                 cloudEventKafkaTemplate.send(ncmpAsyncM2mTopic, UUID.randomUUID().toString(), cloudEvent);
@@ -286,7 +286,7 @@ public class DmiRestStubController {
     public ResponseEntity<Map<String, String>> retrieveDataJobStatus(
             @PathVariable("dataProducerId") final String dataProducerId,
             @PathVariable("dataProducerJobId") final String dataProducerJobId) {
-        log.info("Received request to retrieve data job status. Request ID: {}, Data Producer Job ID: {}",
+        log.debug("Received request to retrieve data job status. Request ID: {}, Data Producer Job ID: {}",
                 dataProducerId, dataProducerJobId);
         return ResponseEntity.ok(Map.of("status", "FINISHED"));
     }
@@ -390,9 +390,9 @@ public class DmiRestStubController {
 
     private void logRequestBody(final Object request) {
         try {
-            log.info("Incoming DMI request body: {}", objectMapper.writeValueAsString(request));
+            log.debug("Incoming DMI request body: {}", objectMapper.writeValueAsString(request));
         } catch (final JsonProcessingException jsonProcessingException) {
-            log.info("Unable to parse DMI request to json string");
+            log.warn("Unable to parse DMI request to json string");
         }
     }
 
@@ -414,4 +414,4 @@ public class DmiRestStubController {
             Thread.currentThread().interrupt();
         }
     }
-}
\ No newline at end of file
+}
index 2cecc14..3b4e384 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2024 Nordix Foundation
+ *  Copyright (C) 2024-2025 OpenInfra Foundation Europe. 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.
@@ -78,7 +78,8 @@ public class ModuleInitialProcessAspect {
         }
 
         final long remainingProcessingTime = calculateRemainingProcessingTime(currentTimestamp, firstRequestTimestamp);
-        log.info("Initial processing for moduleSetTag '{}' is still active. Returning HTTP 503. Remaining time: {} ms.",
+        log.debug("Initial processing for moduleSetTag '{}' is still active."
+                + " Returning HTTP 503. Remaining time: {} ms.",
                 moduleSetTag, remainingProcessingTime);
         return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).build();
     }
index 38f35ac..f67d354 100644 (file)
@@ -1,5 +1,5 @@
 #  ============LICENSE_START=======================================================
-#  Copyright (C) 2023-2024 Nordix Foundation
+#  Copyright (C) 2023-2025 OpenInfra Foundation Europe. 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.
@@ -64,10 +64,3 @@ delay:
     read-data-for-cm-handle-delay-ms: ${READ_DATA_FOR_CM_HANDLE_DELAY_MS:300}
     write-data-for-cm-handle-delay-ms: ${WRITE_DATA_FOR_CM_HANDLE_DELAY_MS:670}
 
-logging:
-    level:
-        org:
-            springframework:
-                web:
-                    filter:
-                        CommonsRequestLoggingFilter: DEBUG