From 91c0e5efde675a9777c84ceaccbb8dd41fdcd271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Thu, 5 Oct 2023 16:28:26 +0200 Subject: [PATCH] docfix/Add more logging at the function getUserAndSessionContextFuture --- obp-api/src/main/scala/code/api/util/APIUtil.scala | 2 ++ obp-api/src/main/scala/code/util/Helper.scala | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/obp-api/src/main/scala/code/api/util/APIUtil.scala b/obp-api/src/main/scala/code/api/util/APIUtil.scala index 15cd9bf260..29290b8085 100644 --- a/obp-api/src/main/scala/code/api/util/APIUtil.scala +++ b/obp-api/src/main/scala/code/api/util/APIUtil.scala @@ -3022,6 +3022,8 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{ val url = URLDecoder.decode(ObpS.uriAndQueryString.getOrElse(""),"UTF-8") val correlationId = getCorrelationId() val reqHeaders = S.request.openOrThrowException(attemptedToOpenAnEmptyBox).request.headers + val title = s"Request Headers for verb: $verb, URL: $url" + surroundDebugMessage(reqHeaders.map(h => h.name + ": " + h.values.mkString(",")).mkString, title) val remoteIpAddress = getRemoteIpAddress() val res = if (APIUtil.`hasConsent-ID`(reqHeaders)) { // Berlin Group's Consent diff --git a/obp-api/src/main/scala/code/util/Helper.scala b/obp-api/src/main/scala/code/util/Helper.scala index 1a1b7a99c1..55f359d4a1 100644 --- a/obp-api/src/main/scala/code/util/Helper.scala +++ b/obp-api/src/main/scala/code/util/Helper.scala @@ -325,6 +325,11 @@ object Helper extends Loggable { logger.error(s"| $msg |") logger.error(s"+-${StringUtils.repeat("-", msg.length)}-+") } + protected def surroundDebugMessage(msg: String, title: String = ""): Unit = { + logger.debug(s"+-${title}${StringUtils.repeat("-", msg.length - title.length)}-+") + logger.debug(s"| $msg |") + logger.debug(s"+-${StringUtils.repeat("-", msg.length)}-+") + } initiate() MDC.put("host" -> getHostname) }