Should logs be disabled before the release of the application?

I am going to release the application. Should I delete the Log and e.printStackTrace() statements in the catch statements?

+4
source share
4 answers

Logs are important resources for troubleshooting, even for deployed software.

I would limit the registration of product releases (perhaps I even limited it to "enter emergency situations"). But I would not categorically say "without registration".

Here is a good discussion (with some good recommendations):

PS: Having said that, I hasten to add:

No, you should not have any "debug" or "informational" release logging.

This is exactly what the Android documentation says in the links above.

+4
source

This is usually considered good practice because:

  • If your log statements are enclosed inside if statements on the debug flag, and you set this flag to false, then when compiling your project these instructions are not automatically taken into account, reducing the size of your apk, although not by much.
  • Since the log is used in conjunction with every other application, it should not have these messages in the production application, since it will clutter up another developer log-code during debugging.
  • Sometimes you can register confidential data such as signatures, keys, passwords, emails, usernames, etc. Disabling logging may prevent your application from accidentally leaking such information.
+2
source

Logging can sometimes lead to security issues. Most Android apps do not need to worry about this for several reasons, but I personally would just be used to disabling developer-based features if you do not want users to help you debug problems on other devices, which is not common practice in my experience .

+1
source

Answer: YES.

You can hide them by 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 application has been signed, no one will be able to read the debug logs, errors and information. Hope this works.

0
source

All Articles