Skip to content

Commit

Permalink
[fix] 에러 로깅 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
isanghaessi committed Aug 29, 2023
1 parent 1d11641 commit d686b66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
package com.beside.startrail.common.errorattribute;

import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.error.ErrorAttributeOptions;
import org.springframework.boot.web.reactive.error.DefaultErrorAttributes;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.server.ResponseStatusException;

@Slf4j
@Component
public class GlobalErrorAttributes extends DefaultErrorAttributes {
@Override
public Map<String, Object> getErrorAttributes(
ServerRequest serverRequest,
ErrorAttributeOptions options
) {
Map<String, Object> attributes = new HashMap<>();
Map<String, Object> attributes = super.getErrorAttributes(serverRequest, options);

Throwable throwable = getError(serverRequest);
Throwable throwable = super.getError(serverRequest);
log.error("", throwable);

if (throwable instanceof ResponseStatusException responseStatusException) {
attributes.put("status", responseStatusException.getStatusCode());
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ server:
key-store-type: PKCS12
key-store-password: local
log:
level: debug
level: info

---

Expand Down

0 comments on commit d686b66

Please sign in to comment.