How can I display the entire exception error code (FullStackTrace) in the Android Log?
try {
//CODE
}catch (Exception e){
Log.e(TAG,e.getStackTrace());
}
How can I display the entire exception error code (FullStackTrace) in the Android Log?
try {
//CODE
}catch (Exception e){
Log.e(TAG,e.getStackTrace());
}
I found it a very practical way, that I honestly did not know it could be done that way.
try {
//CODE
}catch (Exception e){
Log.e(TAG, "Seu erro: ", e);
}
You can use it as follows:
try {
//CODE
} catch (Exception e) {
Log.e(TAG, "log de erro: ", e.getMessage());
Log.v(TAG, "log de verbose: ", e.getMessage());
Log.d(TAG, "log de debug: ", e.getMessage());
Log.i(TAG, "log de info: ", e.getMessage());
Log.w(TAG, "log de alerta: ", e.getMessage());
}
or
Log.e(TAG, "log de erro: ",new RuntimeException("TAG meu erro"));
I use this way:
Log.e("TAG", Log.getStackTraceString(e));