Author Topic: jPCT  (Read 4506 times)

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
jPCT
« on: January 31, 2007, 01:55:52 pm »
Egon, I use this piece of code to add an entire stack trace to the logs.

Perhaps you can find use for it in the official logger.

Code: [Select]

public static String getStackTrace(Throwable aThrowable)
{
   final Writer result           = new StringWriter();
   final PrintWriter printWriter = new PrintWriter(result);
   
   aThrowable.printStackTrace(printWriter);
   return result.toString();
}

To use this, I have a Logger.addError(Throwable e) method.
It just turns the stack trace into a string.

I cannot use the official logger, because I already had my own.


It is very useful for me, so I thought I'd share it.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG