diff --git a/ws/build.gradle.kts b/ws/build.gradle.kts
index ab9221e..cfea23a 100644
--- a/ws/build.gradle.kts
+++ b/ws/build.gradle.kts
@@ -30,8 +30,10 @@ dependencies {
}
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.jetbrains.kotlin:kotlin-reflect")
- implementation("com.yahoo.elide", "elide-spring-boot-starter", "5.0.2")
+ implementation("com.yahoo.elide", "elide-spring-boot-starter", "5.0.9")
+ implementation("org.projectlombok", "lombok", "1.18.20")
implementation("com.h2database", "h2", "1.3.176")
+ implementation("net.rakugakibox.spring.boot:logback-access-spring-boot-starter:2.7.1")
// drivers for models
runtimeOnly("org.apache.hive","hive-jdbc","3.1.2"){
exclude(group="org.apache.logging.log4j", module = "log4j-slf4j-impl")
diff --git a/ws/src/main/kotlin/com/yahoo/yavin/ws/security/UserDetailsService.kt b/ws/src/main/kotlin/com/yahoo/yavin/ws/security/UserDetailsService.kt
index 0318c7b..4560ee9 100644
--- a/ws/src/main/kotlin/com/yahoo/yavin/ws/security/UserDetailsService.kt
+++ b/ws/src/main/kotlin/com/yahoo/yavin/ws/security/UserDetailsService.kt
@@ -5,17 +5,21 @@
package com.yahoo.yavin.ws.security
+import lombok.extern.slf4j.Slf4j
+import org.slf4j.MDC
import org.springframework.security.core.userdetails.UserDetails
import org.springframework.security.core.userdetails.UserDetailsService
import org.springframework.security.core.userdetails.UsernameNotFoundException
import org.springframework.stereotype.Service
@Service
+@Slf4j
class UserDetailsService(private val userRepository: UserRepository) :
UserDetailsService {
override fun loadUserByUsername(username: String): UserDetails {
val user = userRepository.findOneById(username) ?: throw UsernameNotFoundException("User Not Found!")
+ MDC.put("user", user.id)
return UserDetails(user)
}
}
diff --git a/ws/src/main/resources/application.yaml b/ws/src/main/resources/application.yaml
index d79a567..d321780 100644
--- a/ws/src/main/resources/application.yaml
+++ b/ws/src/main/resources/application.yaml
@@ -39,6 +39,9 @@ spring:
ddl-auto: 'none'
jdbc:
use_scrollable_resultset: true
+ properties:
+ hibernate:
+ default_batch_fetch_size: 100
datasource:
url: 'jdbc:h2:file:./build/yavin;DB_CLOSE_DELAY=-1'
username: 'navidev'
diff --git a/ws/src/main/resources/logback-access-spring.xml b/ws/src/main/resources/logback-access-spring.xml
index 7bae3ea..54fa395 100644
--- a/ws/src/main/resources/logback-access-spring.xml
+++ b/ws/src/main/resources/logback-access-spring.xml
@@ -10,7 +10,7 @@
100MB
- %t{yyyy-MM-dd:HH:mm:ss Z} %remoteIP %user %requestURL %statusCode %bytesSent %elapsedTime %header{X-B3-TraceId} %requestContent %responseContent
+ %t{yyyy-MM-dd:HH:mm:ss Z} %remoteIP %user %requestURL %statusCode %bytesSent %elapsedTime %header{X-B3-TraceId} %requestContent
diff --git a/ws/src/main/resources/logback-spring.xml b/ws/src/main/resources/logback-spring.xml
index fff375a..b3d0269 100644
--- a/ws/src/main/resources/logback-spring.xml
+++ b/ws/src/main/resources/logback-spring.xml
@@ -12,7 +12,7 @@
${logDir}/server.log
- %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] [${springAppName}, %X{X-B3-TraceId:-}] %-5level %logger{36}.%M - %msg%n
+ %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] [${springAppName}, %X{X-B3-TraceId:-}] %-5level %logger{36}.%M %mdc{user} - %msg%n
${logDir}/archived/server_%d{yyyy-MM-dd}.log
@@ -26,7 +26,10 @@
-
+
+
+
+
@@ -36,4 +39,4 @@
-
\ No newline at end of file
+