(1)의 예제에서는 메인 밖에서 에러가 발생될 경우에는 에러가 로그파일에 저장되지 않는다. 그래서 다음과 같이 변경해 주면 정상적으로 로그 파일에 저장할 수 있게 된다. public class ExceptionEx { public static void main(String args[]) { PrintStream ps = null; FileOutputStream fos = null; try{ fos = new FileOutputStream("error.log", true); ps = new PrintStream(fos); System.setErr(ps); System.out.println(1); System.out.println(2); System.out.println(3); System.out.print..
log파일은 단순한 파일일 뿐 특별한 의미를 지니는 확장자는 아니다. class ExceptionEx { public static void main(String args[]){ PrintStream ps = null; try { ps = new PrintStream("error.log"); System.out.println(1); System.out.println(2); System.out.println(3); System.out.println(0/0); System.out.println(4); } catch (Exception ee) { ee.printStackTrace(ps); ps.println("예외메시지 : " + ee.getMessage()); } } } error.log파일에 에러 정보가 저..
- Total
- Today
- Yesterday
- reversing
- 자바
- 카타르
- 데이터 과학
- Discrete Mathematics
- 데이터 사이언스
- Algorithms
- Reverse Engineering
- 리버스엔지니어링
- android
- 카타르 음주
- java
- 리버싱
- 자료구조
- 리눅스
- Data Science
- statistical learning
- linux
- Machine Learning
- operating systems
- 머신러닝
- 통계학습
- 대학원
- 기계학습
- 개발
- 운영체제
- 알고리즘
- Data Structure
- 이산수학
- 안드로이드
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |