Tag Archive: Logging

Apr 13

Print the Stack Trace of the Exception to log file

In Java, when an Exception occurres , the following code snippent can be used to print it in a log file import java.io.PrintWriter; import java.io.StringWriter; public static String logStackTrace(Throwable t) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); exp.printStackTrace(pw); pw.flush(); sw.flush(); nLog(“exception  “+ sw.toString()); } public void nLog(String msg) { try …

Continue reading »

Plugin from the creators of Brindes Personalizados :: More at Plulz Wordpress Plugins