private static void reDirectError(){
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask(){
@Override
public void run() {
try {
String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
String userDir = System.getProperty("user.dir") + "/log";
File logDir = new File(userDir);
if(!logDir.exists()){
logDir.mkdir();
}
String fileName = userDir + "/exceptionLog_" + dateStr + ".log";
java.io.FileOutputStream os = new java.io.FileOutputStream(fileName, true);
java.io.PrintStream printStream = new java.io.PrintStream(os);
System.setErr(printStream);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
}
}, 0, 30*1000);
}
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask(){
@Override
public void run() {
try {
String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
String userDir = System.getProperty("user.dir") + "/log";
File logDir = new File(userDir);
if(!logDir.exists()){
logDir.mkdir();
}
String fileName = userDir + "/exceptionLog_" + dateStr + ".log";
java.io.FileOutputStream os = new java.io.FileOutputStream(fileName, true);
java.io.PrintStream printStream = new java.io.PrintStream(os);
System.setErr(printStream);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
}
}, 0, 30*1000);
}