Sanal V
Sanal V

Reputation: 281

Remove all Logs at Once

I am developing an android application where i am using a lot of Logs for printing values at console for debugging purpose. Now i am using Log.i() method in Android. Now actually what the problem , before i have to give to testing team, i have to remove all logs. When the number of classes in the project is small, i can remove it manually. But when the project contains 40 to 50 classes, it is humanly impossible to go to all classes and remove it manually. So is there any settings is availaible in eclipse so that i can remove or disable all logs by changing a single settings or configuration or else is there any jar file that helps for debugging much more easier than Log.i() method. Any suggestion or guidance is highly appreciable

Thanks inAdvance

Upvotes: 1

Views: 1609

Answers (1)

Randroid
Randroid

Reputation: 3698

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

-assumenosideeffects class android.util.Log {
    public static int v(...);
}

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

This answer referred from this link Android hide logs in the application when upload to market

Upvotes: 3

Related Questions