Here you can find the source of printStackTrace(Throwable t)
public static void printStackTrace(Throwable t)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS"); public static void printStackTrace(Throwable t) { serr();//from w w w. j a v a2 s. c o m t.printStackTrace(); } public static void serr(String ln) { println(System.err, ln); } public static void serr() { serr(""); } public static void serr(Object obj) { serr(obj.toString()); } private static void println(PrintStream ps, String ln) { ps.println(getStringBuilder().append(ln)); } private static StringBuilder getStringBuilder() { StringBuilder sb = new StringBuilder("["); sb.append(dateFormat.format(new Date())); sb.append("] "); return sb; } }