From 0d3a0223fd11d431497519f3f9da640aafe00460 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Mon, 28 Oct 2019 16:46:47 -0400 Subject: Add Message tracing logger service. Issue-ID: CCSDK-1046 Signed-off-by: Brinda Santh Change-Id: I509df82ec558cd96934043a5b41ea53aa040cc81 --- .../ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ms/blueprintsprocessor/modules/commons/rest-lib/src') diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt index 2ef5a31bc..cec11ae3c 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt @@ -32,6 +32,7 @@ import org.springframework.http.server.reactive.ServerHttpResponse import reactor.core.Disposable import reactor.core.publisher.Mono import reactor.core.publisher.MonoSink +import java.net.InetAddress import java.time.ZoneOffset import java.time.ZonedDateTime import java.time.format.DateTimeFormatter @@ -43,6 +44,7 @@ class RestLoggerService { fun entering(request: ServerHttpRequest) { + val localhost = InetAddress.getLocalHost() val headers = request.headers val requestID = headers.getFirst(ONAP_REQUEST_ID).defaultToUUID() val invocationID = headers.getFirst(ONAP_INVOCATION_ID).defaultToUUID() @@ -52,7 +54,7 @@ class RestLoggerService { MDC.put("InvocationID", invocationID) MDC.put("PartnerName", partnerName) MDC.put("ClientIPAddress", request.remoteAddress?.address?.hostAddress.defaultToEmpty()) - MDC.put("ServerFQDN", request.remoteAddress?.hostString.defaultToEmpty()) + MDC.put("ServerFQDN",localhost.hostName.defaultToEmpty()) if (MDC.get("ServiceName") == null || MDC.get("ServiceName").equals("", ignoreCase = true)) { MDC.put("ServiceName", request.uri.path) } -- cgit 1.2.3-korg