标签:
代码如下:
| try{
	******
} catch (Exception ex) {
				  try {
					  File file = new File("e:/log.txt");
					  PrintWriter writer = null;
					  FileWriter fileWrite = new FileWriter(String.valueOf(file), true);
					  writer = new PrintWriter(fileWrite);
					  writer.append(System.getProperty("line.separator") + new SimpleDateFormat("yyyy-MM-dd:HH:mm:ss").format(new Date()));
					  writer.append(System.getProperty("line.separator"));
					  writer.append("*************************" + ex.toString() + "*************************");
					  writer.append(System.getProperty("line.separator"));
					  ex.printStackTrace(writer);
					  writer.flush();
					  writer.close();
				  } catch (IOException e) {
					  e.printStackTrace();
				  }
} | 
标签:
原文地址:http://www.cnblogs.com/sjshare/p/4993703.html