class ExceptionInfo
{
public static void main(String[] args){
try{
int[] arr = new int[2];
System.out.println(arr[3]);
}catch (IOException e){
try{
Date d = new Date();
SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = sfd.format(d);
PrintStream pf = new PrintStream("exception.log");
pf.println(s);
System.set(ps);
}
catch (IOException ex){
throw new RuntimeException("日志文件创建失败。");
}
e.printStackTrace(System.out);
}
}
}
二、系统信息: