From 80bc2e4dfa1c3c8ad59ae5518806d88790dcfd47 Mon Sep 17 00:00:00 2001 From: Mikhail Yasnov Date: Mon, 19 Jul 2021 12:31:18 +0300 Subject: [PATCH] Fix LoggerExecutionContext update --- .../spring/web/interceptors/LoggingInterceptor.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/logger-spring-web/src/main/kotlin/ru/touchin/logger/spring/web/interceptors/LoggingInterceptor.kt b/logger-spring-web/src/main/kotlin/ru/touchin/logger/spring/web/interceptors/LoggingInterceptor.kt index 4530c00..96654a0 100644 --- a/logger-spring-web/src/main/kotlin/ru/touchin/logger/spring/web/interceptors/LoggingInterceptor.kt +++ b/logger-spring-web/src/main/kotlin/ru/touchin/logger/spring/web/interceptors/LoggingInterceptor.kt @@ -33,11 +33,15 @@ class LoggingInterceptor( val uri = request.requestURI.let(::URI) LoggerExecutionContext.current.updateContext { context -> - context.plus(DefaultContextFields.id.name to UUID.randomUUID().toString()) - context.plus(DefaultContextFields.host.name to uri.host) - context.plus(DefaultContextFields.path.name to uri.path) - context.plus(DefaultContextFields.httpMethod.name to request.method) - context.plus(DefaultContextFields.ipAddress.name to request.publicIp) + context.plus( + mapOf( + DefaultContextFields.id.name to UUID.randomUUID().toString(), + DefaultContextFields.host.name to uri.host, + DefaultContextFields.path.name to uri.path, + DefaultContextFields.httpMethod.name to request.method, + DefaultContextFields.ipAddress.name to request.publicIp, + ) + ) } logBuilderFactory.create(this::class.java)