Skip to content

Commit

Permalink
chore: (#269) Sentry 로깅 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Jan 2, 2023
1 parent 784a841 commit 17af82a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package team.comit.simtong.global.filter

import com.fasterxml.jackson.databind.ObjectMapper
import io.sentry.Sentry
import org.springframework.http.MediaType
import org.springframework.web.filter.OncePerRequestFilter
import team.comit.simtong.global.error.dto.ErrorResponse
Expand Down Expand Up @@ -32,8 +33,10 @@ class ExceptionFilter(
try {
filterChain.doFilter(request, response)
} catch (e: BusinessException) {
Sentry.captureException(e)
writeErrorCode(e, response)
} catch (e: Exception) {
Sentry.captureException(e)
when (e.cause) {
is BusinessException -> writeErrorCode(e.cause as BusinessException, response)
is WebException -> writeErrorCode(e.cause as WebException, response)
Expand Down
4 changes: 4 additions & 0 deletions simtong-infrastructure/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ spring:
jackson:
property-naming-strategy: SNAKE_CASE

sentry:
dsn: ${SENTRY_DSN}
traces-sample-rate: 1.0

logging:
level:
com:
Expand Down

0 comments on commit 17af82a

Please sign in to comment.