티스토리 뷰

시스템을 운영하던 중 StackTrace 가 로그상에서 출력되지 않는 현상이 발견되었습니다.
Log4j 를 사용하고 있는 환경에서 아래와 같이 로그 출력시 Exception 객체를 넘겨주어 Trace 가 출력되도록 하였음에도 생략되었습니다.

log.error(“Error message”, e);

왜 이런 현상이 발생하는 것일까요?
구글링을 하던 중 아래 링크를 발견하였습니다.

JDK release note 를 확인해보면 아래와 같이 설명하고 있습니다.

The compiler in the server VM now provides correct stack backtraces for all "cold" built-in exceptions. For performance purposes, when such an exception is thrown a few times, the method may be recompiled. After recompilation, the compiler may choose a faster tactic using preallocated exceptions that do not provide a stack trace. To disable completely the use of preallocated exceptions, use this new flag:-XX:-OmitStackTraceInFastThrow.

요약해 보면, 특정 Exception 이 몇번 반복해서 발생한다면 성능 이슈로 stack trace 를 제공하지 않는 Exception 로그를 compiler 는 선택한다라고 되어 있습니다.
만약 이런 Option 을 사용하지 않으려면 -XX:-OmitStackTraceInFastThrow 옵션을 설정해야 합니다.

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

IBATIS CacheModel  (0) 2016.09.26
Exception Propagation  (0) 2016.07.28
json parser 정리  (0) 2016.04.04
Java DBCP Datasource 설정  (0) 2016.02.23
[자바8 람다의 힘] 4장 람다 표현식을 이용한 설계  (0) 2016.02.10
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함