diff --git a/build.gradle b/build.gradle index 66026d61..9203fba9 100644 --- a/build.gradle +++ b/build.gradle @@ -87,7 +87,7 @@ dependencies { testImplementation 'org.awaitility:awaitility:4.2.0' // Slack Webhook - implementation 'com.slack.api:slack-api-client:1.28.0' + implementation 'com.slack.api:slack-api-client:1.30.0' implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.squareup.okhttp3:okhttp:4.10.0' implementation 'com.slack.api:slack-app-backend:1.28.0' diff --git a/src/main/java/sopt/org/motivooServer/global/advice/GlobalExceptionHandler.java b/src/main/java/sopt/org/motivooServer/global/advice/GlobalExceptionHandler.java index 2d14e0c5..5f45982e 100644 --- a/src/main/java/sopt/org/motivooServer/global/advice/GlobalExceptionHandler.java +++ b/src/main/java/sopt/org/motivooServer/global/advice/GlobalExceptionHandler.java @@ -1,13 +1,11 @@ package sopt.org.motivooServer.global.advice; -import static org.springframework.http.HttpStatus.*; -import static sopt.org.motivooServer.global.advice.ErrorType.INTERNAL_SERVER_ERROR; +import static sopt.org.motivooServer.global.advice.ErrorType.*; import java.io.IOException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; @@ -17,7 +15,6 @@ import sopt.org.motivooServer.global.util.slack.SlackUtil; @Slf4j -@Component @RequiredArgsConstructor @RestControllerAdvice public class GlobalExceptionHandler { @@ -35,6 +32,8 @@ public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) public ResponseEntity handleException(final Exception e, final HttpServletRequest request) throws IOException { slackUtil.sendAlert(e, request); + + log.error("🔔🚨 Slack에 전송된 Error Log: {}", e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(ErrorResponse.of(INTERNAL_SERVER_ERROR)); } diff --git a/src/main/java/sopt/org/motivooServer/global/util/slack/SlackUtil.java b/src/main/java/sopt/org/motivooServer/global/util/slack/SlackUtil.java index 1c608658..cdca8fc3 100644 --- a/src/main/java/sopt/org/motivooServer/global/util/slack/SlackUtil.java +++ b/src/main/java/sopt/org/motivooServer/global/util/slack/SlackUtil.java @@ -29,7 +29,6 @@ public class SlackUtil { private final static String NEW_LINE = "\n"; private final static String DOUBLE_NEW_LINE = "\n\n"; - private StringBuilder sb = new StringBuilder(); // Slack으로 알림 보내기 diff --git a/src/test/java/sopt/org/motivooServer/MotivooServerApplicationTests.java b/src/test/java/sopt/org/motivooServer/MotivooServerApplicationTests.java index 093a7f0f..e2747029 100644 --- a/src/test/java/sopt/org/motivooServer/MotivooServerApplicationTests.java +++ b/src/test/java/sopt/org/motivooServer/MotivooServerApplicationTests.java @@ -9,11 +9,11 @@ @SpringBootTest class MotivooServerApplicationTests { - @MockBean - private SlackUtil slackUtil; - - @Test - void contextLoads() { - } + // @MockBean + // private SlackUtil slackUtil; + // + // @Test + // void contextLoads() { + // } }