Reputation: 840
Are there (maybe hidden) techniques which allow to see all log messages emitted from an downloaded app, if I have the device connected to my computer over USB (and running Android Studio)?
If yes, this clearly means that log output should carefully checked before release, so that they do no reveal anything such as full web URLs to production system resources etc.
Upvotes: 2
Views: 2355
Reputation: 208
Yes, when building for release you should not include any logs that output any sensitive data
Upvotes: 2
Reputation: 1436
Yes, log messages are visible from apps downloaded from the Play Store, and you're right; this is a security issue. Viewing the logs from a downloaded app is as simple as plugging in the phone and running adb logcat
.
Consequently, you'll want to use a library like Timber, which allows you to only log in debug mode, or alternatively use ProGuard to strip out all logs at compile time:
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
It's worth noting that logging also impacts your app's performance a little, so it's worth disabling/removing all logging in production anyway just for that.
Upvotes: 4
Reputation: 195
Yes all log are visible in output if you write code for log.
Upvotes: 1