Reputation: 869
I am about to release an app. Should I remove Log
statements and e.printStackTrace()
within the catch
statements ?
Upvotes: 4
Views: 657
Reputation: 6690
The answer is YES.
You can hide them adding some lines to the proguard.cfg file.
-keep class * extends android.app.Activity
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** e(...);
public static *** i(...);
}
After the app has been signed no one will be able to read debug, error and info logs. Hope it works.
Upvotes: 0
Reputation: 121799
Logs are essential troubleshooting resources, even for deployed software.
I would limit logging for production releases (perhaps even limit it to "only log in emergencies"). But I would not categorically say "no logging".
Here is a good discussion (with some good guidelines):
PS: Having said that, I hasten to add:
No, you should not have any "debug" or "informational" logging in a production release.
Which is exactly what the Android documentation, cited in the above links, also says.
Upvotes: 4
Reputation: 82563
This is generally considered to be a good practice because:
Upvotes: 2
Reputation: 3059
Sometimes having logs enabled can create security issues. Most Android applications don't need to worry about this for several reasons, but I would personally just get in the habit of disabling developer based features unless you want users to help you debug issues on other devices which isn't common practice in my experience.
Upvotes: 1