-
Notifications
You must be signed in to change notification settings - Fork 47
Step1 구현하기 #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Step1 구현하기 #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앞으로 구현해야할 미션들을 미리 구현했네. 💯 잘 했다.
피드백 하나 남겼으니 참고하고 다음 단계 힌트를 참고해 추가 리팩토링에 도전해 보면 좋겠다.
|
||
import java.util.Map; | ||
|
||
public class HttpSession { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
세션을 이와 같이 구현할 경우 다수의 사용자별로 세션아이디를 발급하고 식별하는 것이 가능한가?
|
||
@RequestMapping(value = "/user/login", method = RequestMethod.POST) | ||
public String login(User user, HttpSession session) { | ||
log.debug(user.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우연찮게 저장소를 보게 되어서 의견을 남깁니다.
toString()
을 미리 호출하지 않는것이 디버거 레벨이 낮을 때 성능 향상에 도움이 됩니다.
slf4j 면 보통 아래와 같은 스타일로 많이 씁니다.
log.debug("login을 시도한 사용자 : {} " , user);
자세한 내용은 https://www.slf4j.org/faq.html#logging_performance 을 참조하실 수 있습니다.
session.setAttribute("logined", true); | ||
return "redirect:/index.html"; | ||
} catch(Exception e) { | ||
log.error(e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에러 로깅에도 대체로 stacktrace를 다 남기는 것이 오류를 찾는데 도움이 됩니다.
예상한 오류가 있다면 catch절에 구체적인 Exception을 명시하는 것이 좋을것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.baeldung.com/slf4j-log-exceptions 을 참고하실수 있는데. log.error(..)
메서드 중에 Throwable을 넘길수 있는 것이 있습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benelog 소중한 의견 감사드립니다. 피드백에 반영할 수 있었습니다!
역시 프레임워크를 사용하는 이유가 있었네요..
여기저기 하나씩 만들어봤는데 Model부분은 어떻게 해야할지 잘 모르겠어서 하드코딩..하였습니다.
많은 피드백 부탁드립니다!! :)