Reduce log volume in logging-analytics 22/141522/1 master
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Fri, 11 Jul 2025 21:32:48 +0000 (23:32 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Fri, 11 Jul 2025 21:32:48 +0000 (23:32 +0200)
- change Entering and Exiting log lines to debug level
- log http method in URI log line
- remove status text log line (it contains the same information
  as the status code)

Issue-ID: SO-4203
Change-Id: I15e513c7e02b85d6881bc5406fb31339510a4f50
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging/filter/base/AbstractMDCSetupAspect.java
reference/logging-filter/logging-filter-spring/src/main/java/org/onap/logging/filter/spring/SpringClientPayloadFilter.java

index c9424c4..e3cd8ac 100644 (file)
@@ -7,9 +7,9 @@
  * 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
  * 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
  *      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.
  * 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.
@@ -44,7 +44,7 @@ public abstract class AbstractMDCSetupAspect extends MDCSetup {
             setLogTimestamp();
             setElapsedTime();
             MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
             setLogTimestamp();
             setElapsedTime();
             MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
-            logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
+            logger.debug(ONAPLogConstants.Markers.ENTRY, "Entering");
         } catch (Exception e) {
             logger.warn("Error in ScheduledTasksMDCSetup: {}", e.getMessage());
         }
         } catch (Exception e) {
             logger.warn("Error in ScheduledTasksMDCSetup: {}", e.getMessage());
         }
@@ -55,7 +55,7 @@ public abstract class AbstractMDCSetupAspect extends MDCSetup {
             setStatusCode();
             setLogTimestamp();
             setElapsedTime();
             setStatusCode();
             setLogTimestamp();
             setElapsedTime();
-            logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
+            logger.debug(ONAPLogConstants.Markers.EXIT, "Exiting.");
         } catch (Exception e) {
             logger.warn("Error in ScheduledTasksMDCSetup clear MDC: {}", e.getMessage());
         }
         } catch (Exception e) {
             logger.warn("Error in ScheduledTasksMDCSetup clear MDC: {}", e.getMessage());
         }
index 47ea031..77898f1 100644 (file)
@@ -7,9 +7,9 @@
  * 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
  * 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
  *      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.
  * 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.
@@ -46,23 +46,21 @@ public class SpringClientPayloadFilter implements ClientHttpRequestInterceptor {
 
     protected void logRequest(HttpRequest request, byte[] body) throws IOException {
         if (logger.isDebugEnabled()) {
 
     protected void logRequest(HttpRequest request, byte[] body) throws IOException {
         if (logger.isDebugEnabled()) {
-            logger.debug("===========================request begin================================================");
-            logger.debug("URI         : {}", request.getURI());
-            logger.debug("Method      : {}", request.getMethod());
-            logger.debug("Headers     : {}", request.getHeaders());
-            logger.debug("Request body: {}", new String(body, StandardCharsets.UTF_8));
-            logger.debug("==========================request end================================================");
+            logger.debug("===========================request begin=============================================");
+            logger.debug("URI          : {} {}", request.getMethod(), request.getURI());
+            logger.debug("Headers      : {}", request.getHeaders());
+            logger.debug("Request body : {}", new String(body, StandardCharsets.UTF_8));
+            logger.debug("===========================request end===============================================");
         }
     }
 
     protected void logResponse(ClientHttpResponse response) throws IOException {
         if (logger.isDebugEnabled()) {
         }
     }
 
     protected void logResponse(ClientHttpResponse response) throws IOException {
         if (logger.isDebugEnabled()) {
-            logger.debug("============================response begin==========================================");
+            logger.debug("===========================response begin============================================");
             logger.debug("Status code  : {}", response.getStatusCode());
             logger.debug("Status code  : {}", response.getStatusCode());
-            logger.debug("Status text  : {}", response.getStatusText());
             logger.debug("Headers      : {}", response.getHeaders());
             logger.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
             logger.debug("Headers      : {}", response.getHeaders());
             logger.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
-            logger.debug("=======================response end=================================================");
+            logger.debug("===========================response end==============================================");
         }
     }
 
         }
     }