Is it a bad idea to use printStackTrace() for caugt Exceptions?
I believe this is what you need: catch (Exception e) { Log.e(TAG,Log.getStackTraceString(e)); }
I believe this is what you need: catch (Exception e) { Log.e(TAG,Log.getStackTraceString(e)); }
It’s a method on Exception instances that prints the stack trace of the instance to System.err. It’s a very simple, but very useful tool for diagnosing an exceptions. It tells you what happened and where in the code this happened. Here’s an example of how it might be used in practice: try { // … … Read more
Throwable.printStackTrace() writes the stack trace to System.err PrintStream. The System.err stream and the underlying standard “error” output stream of the JVM process can be redirected by invoking System.setErr() which changes the destination pointed to by System.err. or by redirecting the process’ error output stream. The error output stream may be redirected to a file/device whose … Read more
Have a look at the System.Diagnostics namespace. Lots of goodies in there! System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace(); This is really good to have a poke around in to learn what’s going on under the hood. I’d recommend that you have a look into logging solutions (Such as NLog, log4net or the Microsoft patterns and practices … Read more