tags:

views:

670

answers:

4

I was reading the the Android Publishing docs and they said to remove all Log calls from my code. I have some calls to e.printStackTrace() in my code that can be printed as part of the normal running of my program (ie. if a file does not exist yet).

Should I also remove these calls?

A: 

in my modest opinion (I'm not an Android developer)

It should be nice. I don't know the logging options for Android but I'm sure you have some configurable thing to output (or not) your traces.

And if you don't do printStackTrace() Android will not be doing the dirty work of ignoring it.

:)

It's only a good-feeling (style) thing.

helios
I've understood that Android ignores it... is it correct?
helios
+1  A: 

If you allow an Exception to propagate up to the OS then the OS will log it and also pop up a Force Close window, killing your application. If you catch it, then you can prevent your application from being force closed.

If you want your users to have the ability to send you errors that they are getting, then I would log the stack trace. They can then send you the log via an app like Log Collector.

If you want to avoid the possibility of exposing your stack trace information to your users, then catch the exception and don't log it.

mbaird
+1  A: 

I would use Log class for message out put. For logs that you think are important to stay in the app - use Log.i for errors warning - Log.e Log.w For you debug Log.d - and that you can turnoff on base on if your application is in debug mode.

http://developer.android.com/reference/android/util/DebugUtils.html

Alex Volovoy
+2  A: 
Christopher