My application has lots of Log.i(); statements added for debugging. Now if such an application need to be uploaded to market
Should these logs be removed, and if yes is there an easy way than manual removal
If not removed, will those logs be coming if the application is run by the user after installing from the market
( i tried to see the logs for some applications and i couldnt see any logs from the applications. I could see only android logs like from activity manager . But i dont see why the logs will not be displayed if they are not removed from the code)
Yes, a good practice is to remove all the log methods called during testing,
And yes when the user downloads the application it would show all the logs to him/her that you made.
What you can do is Create a
static Class
withstatic
method in that class,when ever you want to make a log call simply call that method from anywhere by ClassName.Method
And once you are finished with testing simply
COMMENT
the Definition in the static method written in the Static class.Preetha, the logs will be kept on the phone and any user/developer can check them out by installing apps like Catlog even without using adb! This is a problem as you stand to give unnecessary and at times, confidential data to users/other developers.
Simple way to solve this?
a. Use Proguard to automatically block all logs, more information in this stackoverflow thread
Here you can automatically block all logs at the bytecode level in Proguard
The above, for example would remove any verbose logging, more in this thread
b. I use a if(DEBUG) Log.i for all my logs, so that with one change of the boolean DEBUG i can switch on/off all logs
c. A trivial solution: replace all Log.i with //Log.i :)