How can I get the stack trace at a position in the code when no exception was generated?
I come using
try
{
// código
}
catch (IOException e)
{
e.printStackTrace();
}
or even
e.getMessage()
within an exception, but I am interested to know if there is any way to obtain the stack trace in a specific part of the code, in order to be able to modify it as text, without generating an exception. For example, to show only the current method and the line. Is there a method to return it to me?