2013-08-02 2 views
1

다음 trycatch 발췌 문장이 있습니다.Google App Engine의 e.printStackTrace

try{ 
    ... 

} catch(Exception e){ 
    System.out.print("error"); 
    e.printStackTrace(); 
} 

error는 관리 콘솔에 표시되지만 I 표준 오차 e.printStackTrace();

답변

4

printStackTrace 출력 표준 출력 System.out 출력을 볼 수 없다. 당신은 표준 출력에 스택 트레이스를 리디렉션 할 수 있습니다 :

e.printStackTrace(new PrintWriter(System.out)); 

는 그런 다음 관리 콘솔에 나타납니다.

0

또 다른 접근법은 스택 추적을 문자열로 변환 한 다음이를 기록하거나 이미 인쇄중인 문자열과 동일하게 인쇄 할 수 있습니다.

다음은 스택 트랙을 문자열로 얻는 방법입니다. How to store printStackTrace into a string