From 262ee3fb3226f8b686f0c95b2d58b3dcc7005910 Mon Sep 17 00:00:00 2001 From: eedo_y Date: Thu, 4 Sep 2025 02:26:05 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=94=A8chore/KIKI-75=20:=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EC=9A=A9=20CICD=20=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-ci-cd.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dev-ci-cd.yml b/.github/workflows/dev-ci-cd.yml index 5bad4fa..27c1f7f 100644 --- a/.github/workflows/dev-ci-cd.yml +++ b/.github/workflows/dev-ci-cd.yml @@ -9,7 +9,7 @@ name: 키키하이 dev CI-CD 파이프라인 on: push: - branches: [ "develop"] + branches: [ "develop","feat/LOG"] jobs: #1. 개발 서버 CI, Build 용 @@ -72,7 +72,6 @@ jobs: echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml echo "${{ secrets.APPLICATION_PROD_YML }}" > ./src/main/resources/application-prod.yml echo "${{ secrets.APPLICATION_OAUTH2_YML }}" > ./src/main/resources/application-oauth2.yml - echo "${{ secrets.LOGBACK_SPRING_XML }}" > ./src/main/resources/logback-spring.xml mkdir -p src/test/resources echo "${{ secrets.APPLICATION_TEST_YML }}" > ./src/test/resources/application-test.yml From a67973295fbeaeb257151ce4f0b357a8493e1011 Mon Sep 17 00:00:00 2001 From: eedo_y Date: Thu, 4 Sep 2025 02:29:51 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=94=A5fix/KIKI-75=20:=20docker-compos?= =?UTF-8?q?e=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 243b355..d5b6d63 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -21,8 +21,6 @@ services: condition: service_healthy kibana: condition: service_healthy - logstash01: - condition: service_healthy networks: - monstache-network From 46e45b850a8c9b255cee1dafd9b6f00936c4d81e Mon Sep 17 00:00:00 2001 From: eedo_y Date: Thu, 4 Sep 2025 22:42:39 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor/KIKI-48=20:=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20=EB=A1=9C=EA=B9=85=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/exception/GlobalExceptionHandler.java | 2 +- .../global/logging/ControllerLoggingAspect.java | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java b/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java index 468a27c..87f9070 100644 --- a/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java +++ b/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java @@ -30,7 +30,7 @@ public class GlobalExceptionHandler { private ApiResponse handleCustomException(CustomException exception) { /// 로그 발생 - log.error("[ERROR 로깅] : {}", exception.getMessage()); + log.error("[ERROR 로깅] : {}", exception.getErrorCode().getMessage(), exception); return ApiResponse.fail(exception); } diff --git a/src/main/java/site/kikihi/custom/global/logging/ControllerLoggingAspect.java b/src/main/java/site/kikihi/custom/global/logging/ControllerLoggingAspect.java index b3eb7b5..6988b8f 100644 --- a/src/main/java/site/kikihi/custom/global/logging/ControllerLoggingAspect.java +++ b/src/main/java/site/kikihi/custom/global/logging/ControllerLoggingAspect.java @@ -50,12 +50,11 @@ public void logBeforeExecution(JoinPoint joinPoint) throws Throwable { } // 로그 출력 - log.info("요청 정보 - 전체URL: {} | URI: {} | 메서드: {} | 유저: {} | Origin: {}", - request.getRequestURL(), - request.getRequestURI(), + log.info("[HTTP 로깅]: {}, [{}] ,{}, {}", + request.getHeader("Origin"), request.getMethod(), - username, - request.getHeader("Origin")); - + request.getRequestURL(), + username); } + } From dbec96f276295b5b2453b803cff4dc3d2b6b43db Mon Sep 17 00:00:00 2001 From: eedo_y Date: Thu, 4 Sep 2025 23:22:25 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor/KIKI-48=20:=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20=EB=A1=9C=EA=B9=85=20=EB=AC=B8=EA=B5=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/global/exception/GlobalExceptionHandler.java | 2 +- .../custom/platform/application/service/SearchService.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java b/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java index 87f9070..1982eac 100644 --- a/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java +++ b/src/main/java/site/kikihi/custom/global/exception/GlobalExceptionHandler.java @@ -30,7 +30,7 @@ public class GlobalExceptionHandler { private ApiResponse handleCustomException(CustomException exception) { /// 로그 발생 - log.error("[ERROR 로깅] : {}", exception.getErrorCode().getMessage(), exception); + log.error("[ERROR 로깅] : {}", exception.getErrorCode().getMessage()); return ApiResponse.fail(exception); } diff --git a/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java b/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java index f119336..bd3e944 100644 --- a/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java +++ b/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java @@ -1,5 +1,6 @@ package site.kikihi.custom.platform.application.service; +import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import org.springframework.data.domain.SliceImpl; @@ -30,6 +31,7 @@ import java.util.UUID; import java.util.stream.Collectors; +@Slf4j @Service @RequiredArgsConstructor public class SearchService implements SearchUseCase { @@ -89,6 +91,9 @@ public Slice searchProducts(String keyword, Pageable pageab .map(ProductESDocument::toDomain) .toList(); + log.info("Searching for {}", elasticProducts.toString()); + + /// 페이징 처리 // 현재 페이지 결과 수 boolean hasNext = checkNext(pageable.getPageNumber(), pageable.getPageSize(), searchHits); From 19c0d2ae5cdf4f7a2780602e645287ca23101fec Mon Sep 17 00:00:00 2001 From: eedo_y Date: Thu, 4 Sep 2025 23:36:04 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor/KIKI-48=20:=20?= =?UTF-8?q?=EA=B8=B0=EC=A1=B4=20=EA=B2=80=EC=83=89=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9E=AC=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/adapter/in/web/SearchController.java | 12 +++--------- .../in/web/swagger/SearchControllerSpec.java | 7 ++++++- .../application/in/search/SearchUseCase.java | 2 +- .../platform/application/service/SearchService.java | 13 ++++++------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/site/kikihi/custom/platform/adapter/in/web/SearchController.java b/src/main/java/site/kikihi/custom/platform/adapter/in/web/SearchController.java index a902077..9d194cb 100644 --- a/src/main/java/site/kikihi/custom/platform/adapter/in/web/SearchController.java +++ b/src/main/java/site/kikihi/custom/platform/adapter/in/web/SearchController.java @@ -30,22 +30,16 @@ public class SearchController implements SearchControllerSpec { @GetMapping public ApiResponse> searchProducts( @RequestParam("keyword") String keyword, - PageRequest pageRequest, + @RequestParam int page, + @RequestParam int size, @AuthenticationPrincipal PrincipalDetails principalDetails ) { - /// Pageable - Pageable pageable = org.springframework.data.domain.PageRequest.of( - pageRequest.getPage() - 1, - pageRequest.getSize(), - Sort.by(Sort.Direction.DESC, "id") - ); - /// 유저가 없다면 null 저장 UUID userId = principalDetails != null ? principalDetails.getId() : null; /// 서비스 호출 - Slice products = service.searchProducts(keyword, pageable, userId); + Slice products = service.searchProducts(keyword, page, size, userId); /// 서비스 호출(총 검색 결과 개수) long countByKeyword = service.countByKeyword(keyword); diff --git a/src/main/java/site/kikihi/custom/platform/adapter/in/web/swagger/SearchControllerSpec.java b/src/main/java/site/kikihi/custom/platform/adapter/in/web/swagger/SearchControllerSpec.java index c47fb25..183c1a7 100644 --- a/src/main/java/site/kikihi/custom/platform/adapter/in/web/swagger/SearchControllerSpec.java +++ b/src/main/java/site/kikihi/custom/platform/adapter/in/web/swagger/SearchControllerSpec.java @@ -25,7 +25,12 @@ public interface SearchControllerSpec { ApiResponse> searchProducts( @Parameter(example = "하우징") @RequestParam("keyword") String keyword, - PageRequest pageRequest, + + @Parameter(example = "1") + @RequestParam int page, + + @Parameter(example = "20") + @RequestParam int size, @AuthenticationPrincipal PrincipalDetails principalDetails ); diff --git a/src/main/java/site/kikihi/custom/platform/application/in/search/SearchUseCase.java b/src/main/java/site/kikihi/custom/platform/application/in/search/SearchUseCase.java index d080baf..dd27eb6 100644 --- a/src/main/java/site/kikihi/custom/platform/application/in/search/SearchUseCase.java +++ b/src/main/java/site/kikihi/custom/platform/application/in/search/SearchUseCase.java @@ -18,7 +18,7 @@ public interface SearchUseCase { /// 검색 - Slice searchProducts(String keyword, Pageable pageable, UUID userId); + Slice searchProducts(String keyword, int page, int size, UUID userId); /// 나의 검색에 목록 확인하기 List getMySearches(UUID userId); diff --git a/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java b/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java index bd3e944..5e53e8e 100644 --- a/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java +++ b/src/main/java/site/kikihi/custom/platform/application/service/SearchService.java @@ -1,6 +1,7 @@ package site.kikihi.custom.platform.application.service; import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import org.springframework.data.domain.SliceImpl; @@ -49,9 +50,10 @@ public class SearchService implements SearchUseCase { /// 키워드 검색 (name, description) @Override - public Slice searchProducts(String keyword, Pageable pageable, UUID userId) { + public Slice searchProducts(String keyword, int page, int size, UUID userId) { /// Pageable 구성 + Pageable pageRequest = PageRequest.of(page - 1, size); // match 쿼리 구성 Query nameMatch = MatchQuery.of(m -> m.field("name").query(keyword))._toQuery(); @@ -67,7 +69,7 @@ public Slice searchProducts(String keyword, Pageable pageab // NativeQuery NativeQuery query = NativeQuery.builder() .withQuery(boolQuery) - .withPageable(pageable) + .withPageable(pageRequest) .withMinScore(minScore) .build(); @@ -91,14 +93,11 @@ public Slice searchProducts(String keyword, Pageable pageab .map(ProductESDocument::toDomain) .toList(); - log.info("Searching for {}", elasticProducts.toString()); - - /// 페이징 처리 // 현재 페이지 결과 수 - boolean hasNext = checkNext(pageable.getPageNumber(), pageable.getPageSize(), searchHits); + boolean hasNext = checkNext(page, size, searchHits); - Slice products = new SliceImpl<>(elasticProducts, pageable, hasNext); + Slice products = new SliceImpl<>(elasticProducts, pageRequest, hasNext); return toProductListResponse(userId, products); } From c931537e1213cbe63020bdab9a22fb453de87b84 Mon Sep 17 00:00:00 2001 From: eedo_y Date: Sat, 6 Sep 2025 06:17:51 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=E2=9C=A8feat/KIKI-75=20:=20logback-spring.?= =?UTF-8?q?xml=20=ED=94=84=EB=A1=9C=ED=8C=8C=EC=9D=BC=EB=B3=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback-spring.xml | 53 +++++++++++++++++++-------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 110da57..c60cfd3 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,19 +1,42 @@ + - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{36}) - %msg%n - - + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{36}) - %msg%n + + - - kkh-logstash:5044 - - %msg%n - - + + 127.0.0.1:5044 + + %msg%n + + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{36}) - %msg%n + + + + + kkh-logstash:5044 + + %msg%n + + + + + + + + - - - - From 7909ba28547c0399c814cbb5c256d48e2822851b Mon Sep 17 00:00:00 2001 From: eedo_y Date: Sat, 6 Sep 2025 06:24:37 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=94=A8chore/KIKI-75=20:=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=94=84=EB=9D=BC=EC=9D=B8=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B8=8C=EB=9E=9C=EC=B9=98=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-ci-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-ci-cd.yml b/.github/workflows/dev-ci-cd.yml index 27c1f7f..d75f9a4 100644 --- a/.github/workflows/dev-ci-cd.yml +++ b/.github/workflows/dev-ci-cd.yml @@ -9,7 +9,7 @@ name: 키키하이 dev CI-CD 파이프라인 on: push: - branches: [ "develop","feat/LOG"] + branches: [ "develop"] jobs: #1. 개발 서버 CI, Build 용