Hello:
I have a simple class logger, for applications and keep a log of exceptions:
Code:
import java.io.*;
/** Class that will act as a general logger for the system, intended for debugging and status control
*
* @author KingCrimson
*/
public final class Logger
{
private static PrintWriter file;
public static synchronized void log(String what)
{
try
{
file = new PrintWriter(new FileWriter("c:/ccss.log", true));
file.println(what);
file.close();
}
catch(Exception e)
{
System.out.println("Error en archivo");
e.printStackTrace();
}
}// log
}// logger
and I wanna print there all info related to exceptions, but in a catch statement, the Exception e has a method e.printStackTrace() wich is void, can I take that info and pass it as a string so it suits my Logger class and do something like:
Logger.log(e.printStackTrace());
I've been using the e.getMessage() and the e.toString() but it's not quite the same
Please Help! Thanks a lot
Poeta