I have this error stack trace method which sends to log4j error messages:
public void writeErrorStackMessage(String message)
{
log.error(message);
}
I want also to add printing of stack trace into file.
catch (Exception e)
{
lm.writeErrorStackMessage(e.printStackTrace());
}
The question is what is the proper way to send the error stack as message?
Edit:
public void writeErrorStackMessage(String message)
{
log.error(message);
}
catch (Exception e)
{
lm.writeErrorStackMessage(Arrays.toString(e.getStackTrace()));
}
I modified the code this way.