출처: 

- https://m.blog.naver.com/PostView.nhn?blogId=njk118&logNo=220701895258&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2F

- http://ukjin.tistory.com/130





1. e.getMessage() vs e.toString() vs e.printStackTrace()

e.getMessage(): error 이벤트와 함께 들어오는 메세지를 출력.


e.toString(): error 이벤트의 toString()을 호출해서 간단한 error 메세지 출력.


e.printStackTrace(): error 메세지의 발생 근원지를 찾아서 단계적으로 error를 출력.


2. log4j에서 e.printStackTrace() 메세지를 log에 남기는 방법

logger.error("some error occured!!", e);


또는


logger.debug("some error occured!!", e);


'IT > Java' 카테고리의 다른 글

== vs equals() 개념  (0) 2018.11.04
try-catch-finally 실행 순서  (0) 2018.10.25
@builder 관련 내용  (0) 2018.03.08
String to char[]  (0) 2018.02.24
Java 환경변수 설정 이유  (0) 2018.02.04

+ Recent posts