Here you can find the source of printStackTrace(PrintWriter writer, Thread thread, StackTraceElement[] trace)
private static void printStackTrace(PrintWriter writer, Thread thread, StackTraceElement[] trace)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 Google, Inc./*from www . j a v a2 s . co m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Google, Inc. - initial API and implementation *******************************************************************************/ import java.io.PrintWriter; public class Main { private static void printStackTrace(PrintWriter writer, Thread thread, StackTraceElement[] trace) { try { writer.println(thread.toString() + ":"); for (int i = 0; i < trace.length; i++) writer.println("\tat " + trace[i]); } catch (Exception e) { writer.println("\t*** Exception printing stack trace: " + e); } writer.flush(); } }