Does the creation of logs affect system memory in any way?

We usually put logs to check if any block of code is being executed or not. But we don't delete it at all before publishing the app. I do not know about others, but I am fond of this function and freely use it in my applications. Someone tell me what will affect the system memory by writing any of the forms Log.x () (where X = v, e, w, i, d). Can anyone help me understand some concepts?

+3


source to share


4 answers


There will definitely be a lot of effect on memory usage, APK file size and performance.

In addition, all logs must be deleted before publishing the application.

Of course, once you delete all the magazines and publish it, its pain overwrites them.

Hence, use Proguard , which removes all logs from ByteCode, but does not affect the source code.



Besides removing logs, Proguard helps in improving performance by obfuscating code, removing unused methods, variables, etc. It all depends on how you set it up.

Enabling ProGuard in Eclipse for Android

How can I avoid reverse engineering my APK file?

+4


source


Logs are stored in memory. Where memory space is required. We must remove the debug logs before release. There should only be error logs.



+1


source


YES Definitely. And To use Logs effectively, always try to use a boolean flag like:

boolean debug = true or false;

      

and wherever you use log.d ("ClassName", "message"); write it like

if(debug) log.d("ClassName","message");

      

and you can control the logging (Logs) with a single boolean flag.

thank.

+1


source


It depends on how many magazines you are using. Of course, this will affect the application. So use this before releasing your app.

Android: = debug "false"

0


source







All Articles