Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.jspecify.annotations.NonNull;
import org.slf4j.MDC;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -59,6 +60,7 @@ protected void doFilterInternal(

requestUserContext.setEmail(email);
requestUserContext.setUserId(userId);
MDC.put("userInfo", email);

if (isGuestRequest(userId)) {
validateGuestRequestNotIllegal(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public Executor embeddingTaskExecutor() {
executor.setCorePoolSize(2);
executor.setMaxPoolSize(5);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("QuestionEmbedding-Thread-");
executor.setThreadNamePrefix("qna-embed-");
executor.initialize();
return executor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void doFilterInternal(
String clientIp = getClientIp(request);
String queryString = request.getQueryString();
String decodedQueryString = "";
MDC.put("clientIp", clientIp);
MDC.put("userInfo", clientIp);

if (queryString != null && !queryString.isEmpty()) {
decodedQueryString = "?" + URLDecoder.decode(queryString, StandardCharsets.UTF_8);
Expand All @@ -57,7 +57,7 @@ protected void doFilterInternal(
long duration = System.currentTimeMillis() - startTime;
int status = response.getStatus();
log.info("[Resp] HTTP {} ({} {}) - {}ms", status, method, requestUriWithQuery, duration);
MDC.remove("clientIp");
MDC.remove("userInfo");
MDC.clear();
}
}
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<!-- Console Appender -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%clr(%d{MM-dd HH:mm:ss.SS}){faint} %clr(%5p) %clr([%X{traceId:-NO_TRACE}]){yellow} %clr([%-15.15X{clientIp:-NO_IP}]){blue} %clr([%10.10t]){faint} %clr(%-32.32logger{32}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
<pattern>%clr(%d{MM-dd HH:mm:ss.SS}){faint} %clr(%5p) %clr([%X{traceId:-NO_TRACE}]){yellow} %clr([%-15.-15X{userInfo:-NO_INFO}]){blue} %clr([%13.13t]){faint} %clr(%-26.26logger{26}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
</encoder>
</appender>

<!-- Rolling File Appender (dev, prod) -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/refit-application.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SS} %5p [%X{traceId:-NO_TRACE}] [%-15.15X{clientIp:-NO_IP}] [%10.10t] %-32.32logger{32} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SS} %5p [%X{traceId:-NO_TRACE}] [%-15.-15X{userInfo:-NO_INFO}] [%13.13t] %-26.26logger{26} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 매일 로그 파일을 새로 만들고, 최대 30일 보관 -->
Expand Down
Loading