Skip to content

Commit

Permalink
feat: 예외 처리 및 로깅 형식 수정 (#395)
Browse files Browse the repository at this point in the history
* fix: 리스트 형태의 요청 바디에 null을 넣으면 500이 뜨는 에러 수정

* feat: 로그를 json 형태로 수정

* feat: 로그를 json 인덴트 추가
  • Loading branch information
3Juhwan authored Aug 19, 2024
1 parent 8700259 commit 07f4bf3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
public class GlobalExceptionHandler {

private static final String LOG_FORMAT = """
{
\n\t{
"RequestURI": "{} {}",
"RequestBody": "{}",
"RequestBody": {},
"ErrorMessage": "{}"
}
\t}
""";

@ExceptionHandler(AuthenticationException.class)
Expand Down Expand Up @@ -81,7 +81,7 @@ public ResponseEntity<ErrorResponse> handleException(HttpServletRequest req, Exc

private String getRequestBody(HttpServletRequest req) {
try (BufferedReader reader = req.getReader()) {
return reader.lines().collect(Collectors.joining(System.lineSeparator()));
return reader.lines().collect(Collectors.joining(System.lineSeparator() + "\t"));
} catch (IOException e) {
log.error("Failed to read request body", e);
return "";
Expand Down

0 comments on commit 07f4bf3

Please sign in to comment.