From: ToineSiebelink Date: Thu, 12 Jun 2025 16:35:59 +0000 (+0100) Subject: Remove Excessive Logging from DMI Stub X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=e14f9a532890f0ad735ffa28ffcf028300240c04;p=cps%2Fncmp-dmi-plugin.git Remove Excessive Logging from DMI Stub - 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 Change-Id: Ice0e2ac0d425de02d1d872cc7f3173746c2f029c --- diff --git a/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java b/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java index cf18f239..6a8530fb 100644 --- a/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java +++ b/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java @@ -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> 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 +} diff --git a/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/aop/ModuleInitialProcessAspect.java b/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/aop/ModuleInitialProcessAspect.java index 2cecc145..3b4e384a 100644 --- a/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/aop/ModuleInitialProcessAspect.java +++ b/dmi-stub/dmi-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/aop/ModuleInitialProcessAspect.java @@ -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(); } diff --git a/dmi-stub/dmi-stub-service/src/main/resources/application.yml b/dmi-stub/dmi-stub-service/src/main/resources/application.yml index 38f35ac9..f67d3546 100644 --- a/dmi-stub/dmi-stub-service/src/main/resources/application.yml +++ b/dmi-stub/dmi-stub-service/src/main/resources/application.yml @@ -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