Code example for SimpleDateFormat

Methods: format

0
	/** 
	 * Write the exception stacktrace to the error log file  
	 * @param e The exception to log 
	 */ 
	public static void logError(Exception e, String msg) {
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = new Date();
		String now = dateFormat.format(date);
		 
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		e.printStackTrace(pw);
		 
		String error = "An Exception Occured @ " + now + "\n" + 
			"In Phone " + Build.MODEL + " (" + Build.VERSION.SDK_INT + ") \n" + 
			msg + "\n" + 
			sw.toString();
		//Log.e("BookCatalogue", error); 
		 
		try { 
			// RELEASE Remove Log.e! Replace with ACRA?